Go Back   CodingForums.com > :: Server side development > Other server side languages/ issues

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-24-2002, 01:35 AM   PM User | #1
Borgtex
Regular Coder

 
Join Date: Aug 2002
Location: Spain
Posts: 420
Thanks: 0
Thanked 0 Times in 0 Posts
Borgtex is an unknown quantity at this point
redirect a wong url to his lower case version

for example, if the user writes http://myurl.com/TheFolder and it doesn't exist, redirect to http://myurl.com/thefolder. I can do it using javascript in the 404.shtml page, but I'm sure that there is a better & more intelligent way


My server uses Apache. "Answer for dummies" please, I'm not very familiar with Apache & server languages / includes
__________________
Don't resist to assimilation. Billions of Borgs can't be wrong!
Borgtex is offline   Reply With Quote
Old 12-27-2002, 08:04 PM   PM User | #2
Borgtex
Regular Coder

 
Join Date: Aug 2002
Location: Spain
Posts: 420
Thanks: 0
Thanked 0 Times in 0 Posts
Borgtex is an unknown quantity at this point
Well, seems that it can't be done. It was a nice idea
__________________
Don't resist to assimilation. Billions of Borgs can't be wrong!
Borgtex is offline   Reply With Quote
Old 01-04-2003, 10:07 AM   PM User | #3
Feyd
Regular Coder


 
Feyd's Avatar
 
Join Date: May 2002
Location: Los Angeles, CA Maxim: Subvert Society
Posts: 404
Thanks: 0
Thanked 0 Times in 0 Posts
Feyd is an unknown quantity at this point
The best option is mod_spelling, which will allow you to ignore case and have up to 'one misspelling' in a URL. It may be beyond your skills or access to the box, however. If it is already installed, try just sticking CheckSpelling on in an htaccess file for your site.

Or you could make it conditional by checking to see if mod_spelling is available, and if it is turn it on:
Code:
<IfModule mod_speling.c>
  Checkspelling on
</IfModule>
You could do it (though not truly) through mod_rewrite in htaccess, but it would be pretty inefficient and be too heavy for what I would want to use...but it is doable.

The real reasons you can't do it is that regex and substitution patterns need a per character pattern. Second, making them all upper or all lower case dynamically will not really help with case insensitive URLs, because the case that is typed in must access the case as it exists in the file-system (and making it all lc or all uc will not necessarily get the filename as it truly exists). Mod-spelling is the best way to go.

Like I said, you could do it through mod_rewrite, but it would be extremely heavy and nasty...it would perform this extremely heavy and nasty check with EVERY SINGLE FILE ACCESS on your site (though you could make it semi-smart and order it not to check certain file types, but what about the case sensitivity of those file types?).

The real and best way is to use all lowercase for your directories and file names, period.
__________________
Moderator, Perl/CGI Forum
shadowstorm.net - subvert society
Feyd is offline   Reply With Quote
Old 01-04-2003, 02:54 PM   PM User | #4
Borgtex
Regular Coder

 
Join Date: Aug 2002
Location: Spain
Posts: 420
Thanks: 0
Thanked 0 Times in 0 Posts
Borgtex is an unknown quantity at this point
Ok thanks I will take a look at it

In fact the situation is the following:
I have a domain and offer a free subfolder for the customers that don't want to buy a domain name:

mydomain.com/ramblabar
mydomain.com/musicson
..and so on

So if somebody writes i.e. RamblaBar, RAMBLABAR or RaMbLaBaR, I want the sistem to lowercase it (as I always use lowercase) and see if it exist, no need to check all the site looking for the specific file

Now I'm using this javascript for the 404 page:
<script>
errurl='<!--#echo var="REQUEST_URI" -->'
corrurl=errurl.toLowerCase()
if (errurl!=corrurl) {self.location=corrurl} else {document.write('Error 404')}
</script>

It works fine, but don't looks very "professional"
__________________
Don't resist to assimilation. Billions of Borgs can't be wrong!
Borgtex is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:17 AM.


Advertisement
Log in to turn off these ads.