Redirect 301 drag the variable

0

I am creating some 301 redirects in one of my sites, to eliminate indexed URLs and leave it a little more optimized.

Well, if I redirect between tags for example:

redirect 301 /videos/coche-electrico.html https://www.dominio.com/videos/coches-electricos.html

It works well, that is, it redirects correctly. The problem I have is when I try to do a similar redirect, but instead of redirecting between tags like the previous case, I try to do it from label to category. That is:

redirect 301 /videos/coche-electrico.html https://www.dominio.com/categoria/coches-electricos/

Making me redirect like this:

https://www.dominio .com/categoria/coches-electricos/?tag=coche-electrico

Part of the .htaccess code is this:

Rewriterule ^videos/(.)_(.).html$ index.php?tag=$1&page=$2 [L,NC]
Rewriterule ^videos/(.*).html$ index.php?tag=$1 [L,NC]

I have also tried to isolate the problem and only do so:

RewriteRule ^clientes/(\w+)/?$ clientes.php?id=$1 [L]
Redirect 301 /clientes/juan http://google.es 

And the redirection that he makes in this case in google, also drags the id=juan :

https://www.google.es/?id=juan&gws_rd=ssl

Does anyone know how I can do the redirect without passing any parameter or value, leaving the redirection clean?

https://www.dominio.com/categoria/coches-electricos/
    
asked by vpme 05.06.2017 в 18:02
source

2 answers

0

You can use the script option of the RewriteRule

Add this in front of all your RewriteRules so that the following RewriteRule will not be executed when they meet the conditions.

RewriteRule ^/videos/coche-electrico.html$ - [L]

What that instruction does is that if you find what you're looking for, DO NOT modify it (the script does that) and then with [L] you tell it to no longer run RewriteRules.

    
answered by 07.06.2017 в 09:54
0

Apache adds the search parameters when none is specified. As far as you can:

  • Set a new empty parameter (the ? at the end).

    Redirect 302 /videos/coche-electrico.html https://url.com/aaa/bbb/?
    

  • Use [QSD] ( query string discard ) to define that they are deleted.

    RewriteEngine On
    RewriteRule ^videos/coche-electrico\.html$ https://url.com/aaa/bbb/ [R=302,NC,L,QSD]
    
  • answered by 07.06.2017 в 10:37