문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top