La regla de redirección .htaccess 301 no funciona debido a las letras mayúsculas
Frecuentes
Visto 1,144 equipos
2
I have some 301 redirect rules failing because of capital letters in the URL. Problem is... that is how they appeared in the old site, so I would like them to be case-sensitive.
Esto no funciona:
Redirect 301 /folder/HeyThere.html http://www.newsite.com
pero esto lo hace
Redirect 301 /folder/heythere.html http://www.newsite.com
Doesn't seem like a lower-case character rule applies to both upper-case and lower-case letters, but I need to have this work for URLs with upper-case letters in them. I'd like to have it work for both, but is there something I can do to ensure this works properly if someone comes from a URL with an upper-case character?
2 Respuestas
1
Es mejor que uses mod_rewrite
for ignore case handling:
RewriteRule ^folder/heythere\.html$ http://www.newsite.com [R=301,NC,L]
Debido a la presencia de NC
flag (no case) here it will redirect both /folder/HeyThere.html
y /folder/heythere.html
to newsite.
Respondido 12 Feb 14, 06:02
0
You can use regular expression with RedirectMatch for create dynamic rules.
RedirectMatch 301 /folder/(?i)HeyThere.html http://www.newsite.com
(?i) is used for case insensitivity for next characters.
I hope this will work for you :)
Respondido 12 Feb 14, 07:02
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas apache .htaccess mod-rewrite redirect http-status-code-301 or haz tu propia pregunta.
The syntax provided in your answer doesn't seem to be taking effect... for lower case or uppercase - RC Neil
Pusiste
RewriteEngine On
before my rule? btw this should be placed inDocumentRoot/.htaccess
no en el interior/folder/.htaccess
- anubhavaIndeed. I placed this rule after multiple after
Rewrite Engine On
and multiple working301 Redirect
rules. In the root. Could there be another rule conflicting with this? - RC NeilMake this rule your very first rule after
RewriteEngine On
and test in a new browser to avoid 301 caching issues. - anubhavaSyntax looks like this
RewriteEngine On RewriteBase / RewriteRule ^folder/heythere\.html$ http://www.newsite.com [R=301,NC,L]
and it still doesn't work. Old browser, new browser, cleared cached... - RC Neil