In .htaccess on Apache2, how do you redirect all capitalization variations of a hostname to a canonical lowercase version, via 301 redirect, and keeping the rest of the path unharmed. Subdomains (or not) should do the same as well.
Additionally, accessing via an IP should not redirect.
examples:
http://Example.com/foo=>http://example.com/foohttp://A.example.com/foo=>http://a.example.com/foohttp://A.EXample.com/foo?bar=>http://a.example.com/foo?barhttp://208.67.222.222/foo=>http://208.67.222.222/foo
1 Answer