Forum Moderators: phranque

Message Too Old, No Replies

Make capitalization not important // htaccess

htaccess capitalisation capitalization

         

vovovo

10:21 pm on Sep 7, 2008 (gmt 0)



Been looking for a while now... I want to use htaccess to make:

http://www.example.com/hello.php

the same as

http://www.example.com/Hello.php

or

http://www.example.com/HeLlo.php

You get the point. Any idea? Been looking everywhere.

g1smd

10:27 pm on Sep 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



That's a very bad idea, as it will lead to infinite duplicate content, and that leads to problems with search engines listing your pages.

I would recommend that close, but incorrectly cased, URLs are instead fed a 301 redirect to the correct version of the URL... usually one that is all lower case.

jdMorgan

11:36 pm on Sep 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, do a search here on WebmasterWorld (link at top of page) for "duplicate content" and see the mess you can get yourself into by making URLs case-insensitive in violation of the HTTP specifications.

As g1smd says, use a 301 redirect from the mis-cased URL to the proper (single) URL. One object (page, image, script, etc.) on the Web should be accessible by one and only one URL.

This includes www.example.com versus example.com, example.com/ versus example.com/index.php, and example.com/Page versus example.com/page -- to start. :)

You can do case-conversion with mod_rewrite in .htaccess, but it is horribly-inefficient and slow.

Jim