Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

Starts at just $1 per CPM or $0.10 per CPC.

How do I make Linux server urls case insensitive?

When the user types into the address bar: www.mySite.com the user will get an error because linux server urls are case sensitive and the url is www.mysite.com. How would I make it so the urls are case insensitive. I've been trying a PHP script but it doesn't seem to be working (It just takes me to the index directory of the folder and gives a 403 forbiden error.) Is there any code I can place on my site that will make the urls case insensitive?

I have to say I've never heard of this occurring before. Most browsers will send the lowercase version of the domain name to the server regardless. Are you sure you don't mean that your file names are case sensitive?

I have to say I've never heard of this occurring before. Most browsers will send the lowercase version of the domain name to the server regardless. Are you sure you don't mean that your file names are case sensitive?

Click to expand...

Have the same experience, file names are the "problem", not the domain. Any solution to this via htaccess?

Yes, I meant the filename. But how would I get the filename to my PHP script? I created a PHP script that gets the referer of the page, strtolower() it, and then puts the user through via header() to the lowercased page, but it seems to me that the browser never gets to my script. It gives a 403 forbiden error and the url looks like it is trying to get the file folders like www.mysite.com/script/ How would I get the browser to go to the script if there is an error in the filenames case? I tried using 404 error page but it isn't working.

Keep in mind that __NAMES ARE CASE SENSITIVE. IT IS NOT A FAULT OR PROBLEM OF THE SERVER__
Ask your web host to install the Apache module "mod_speling" (speling, not spelling)
It will redirect incorrect case to the right lowercase one and correct typos (in a SEO friendly way)

I was thinking about using a php code that will strtolower the filename and then use header to take the user to the correct page but I can't figure out how to get my PHP file to run if there is an error in the filename. Does anyone know how I could do this?

I placed this .htaccess file in the same folder that is using the rewrite and turned off word-wrap.
It is still not working. I am using Godaddy Linux hosting. Could you please tell me why this isn't working? It looks like what I am looking for.

OK well since nobody has managed to find a solution to this yet, I thought I'd share with you the method I originally suggested that works. There are two (three possibly) files you will need for this
1 - The .htaccess file

<?php
// get the lowercase version of the URI
$lower = strtolower($_SERVER['REQUEST_URI']);
// If the URI isn't the same as the lowercase version, redirect to the lowercase version
if($_SERVER['REQUEST_URI'] !== $lower) {
header('Location: '.$lower);
die();
}else{
//Otherwise give a 404 error
header("HTTP/1.0 404 Not Found");
die();
//You could remove the die() line above of course to allow this to execute
//This will send the user to the errordocument.php file, where you can show
//your custom error document file if you wish
header('Location: /errorDocument.php');
die();
}

Now the webpage won't even load if I type the url in uppercase. I don't know what's wrong.

Here is some information which might help you help me:

My .htaccess file is saved with the encoding as 'ANSI' if this matters?
I copied your code exactly into the correct file names.
My .htaccess file and badRequest.php file are in the same directory which is inside the one that I am trying to fix.

Imozeb, the code you posted with a RewriteMap directive in it doesn't work because that particular directive isn't allowed in an htaccess file on any Apache server. Each directive has what's called a "context" in which it is available, if when looking at an Apache manual page you don't see .htaccess listed for that directives context, you can't use it in htaccess.

What also sucks about that in this case, is you can't explicitly use the internal tolower function as a map in RewriteRule like you might think. So something like this, isn't going to work.

I put your code in a .htaccess file in the directory it is supposed to modify. Is this correct and should I have an index page for this directory because it seems like when I type in the url it deletes the filename and just puts everything up to the slash /.

It still isn't working. Would a link to my site help or is there any more information I could give?