Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Case Sensetive folders?

Status
Not open for further replies.

blanius

Programmer
Mar 3, 2002
30
US
On the server the directories are case senestive. Is there an easy way to handle a user entering in say an all lowercase name like mysub and it take them to mySub anyway?

Bret Lanius
 
You can make a custom 404 page that will redirect to the right page if your site is on a Unix/Linux or Mac web server. I'd recommend using server-side scripting for that so the 404 page doesn't have to load onto the client computer.

The best way to handle that is use links on a page in your web root so someone doesn't HAVE to type in a URL that might be case sensitive. I also don't recommend using mixed case directory names, especially with a web host where case sensitivity is an issue. You're just asking for user frustration and complaints with that.

Lee
 
It'd be a lot easier (and make more sense, IMO) just to make the folders all lower case letters since that's what Internet users are used to now.

Lee
 
If you can be consistent with the case of your files and directories (I concur with the others that all lowercase is best), a little PHP/ASP server-side file like the following would do the trick for most situations (I didn't test this, but it should be right):
Code:
<?php
header("Location: " . strtolower($HTTP_ENV_VARS['REQUEST_URI']) . $HTTP_ENV_VARS['QUERY_STRING']);
?>
I separated the URI from non-path content (anchors, GET variables, etc.) because you wouldn't want to strip capitalization from variable values. The only case this little script wouldn't cover would be variables from a form that uses method=POST (I would need more than two minutes to write something that would take care of that).

But if you want to have your filenames in mixed case, that would be a different animal...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top