How to redirect a url with regular expressions

2

I am using the redirection plugin and I want to redirect from a category url to an article url.

Of https://www.misitio.com/perros-gatos/razas/page/12/

a Destination URL: https://www.misitio.com/razas/

What I had done was redirect from https://www.misitio.com/perros-gatos/razas/ to https://www.misitio.com/razas/

With this last one everything works well except in paging, where I'm getting 404 errors.

https://www.misitio.com/perros-gatos/razas/page/12/

I've been testing:

of: ^/perros-gatos/razas/([A-Za-z0-9-]*)/$

a: misitio.com/razas/

But the code does not work for me.

    
asked by JhonnySanz 08.08.2018 в 19:33
source

1 answer

2

If you move from misitio.com/perros-gatos/razas/page/12 to misitio.com/razas , you are losing pagination. So I understand that what you want is that the page number is hidden in some way.

If so, you can not use .htaccess for that purpose, since you can not convert GET requests to POST (see this question in OS)

A possible solution would be to have the page misitio.com/razas where all the data / pages are received via AJAX requests. In this way, in the url of the page you would never get to see the number of it. It would go as a parameter in the different AJAX requests that you make.

    
answered by 05.11.2018 в 02:06