Domanda

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.

This doesn't work:

Redirect 301 /folder/HeyThere.html http://www.newsite.com

but this does

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?

È stato utile?

Soluzione

You better use mod_rewrite for ignore case handling:

RewriteRule ^folder/heythere\.html$ http://www.newsite.com [R=301,NC,L]

Due to presence of NC flag (no case) here it will redirect both /folder/HeyThere.html and /folder/heythere.html to newsite.

Altri suggerimenti

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 :)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top