I have a problem with some redirections in a site when creating a redirection of a <etiqueta>.html
to a <categoria>/
. The problem is that you drag the variable.
The <etiqueta>
s are a predefined list by me (it's not any text).
Example 1
-
Original URL in the request:
dominio.com/videos/coches-electricos.html
-
URL to which you must redirect:
dominio.com/gratis/coches-electricos/
-
And you must rewrite it to access the resource (eliminating all the GET parameters that you might have) to:
dominio.com/index.php?cat=coches-electricos
Example 2
and I want it to be:
https://www.dominio.com/gratis/coches-electricos/
redirected to:
https://www.dominio.com/categoria/coches-electricos/?tag=coche-electrico
Code
The htaccess code to create the rewrite mod I'm using is:
Rewriterule ^videos/(.*)_(.*).html$ index.php?tag=$1&page=$2 [L,NC]
Rewriterule ^videos/(.*).html$ index.php?tag=$1 [L,NC]
Rewriterule ^gratis-(.*).html$ index.php?page=$1 [L,NC]
Rewriterule ^gratis/(.*)/(.*)/$ index.php?cat=$1&page=$2 [L,NC]
Rewriterule ^gratis/(.*)/$ index.php?cat=$1 [L,NC]
and to create the 301 redirect I'm using:
redirect 301 /videos/coches-electricos.html https://www.dominio.com/gratis/coches-electricos/