Jump to content

Is there a setting at my website level that allows me to make my site case insensative? Currently it is case case sensative such that indEx.html does not resolve to index.html, but I would like it to.


glennbob

Recommended Posts

I searched a bit with google and see that it is common for unix & linux based servers to be case sensitive, which I didn't realize until I was testing a page on my site. My searches also found that there is a server setting to change this, but it wasn't clear to me if this means I can have my own setting for this at the level of my website? Or if all websites on a server (such as Tommy) just inherit how Tommy is configured and we are unable to have our own setting?

Thanks 

Link to comment
Share on other sites

Yeah, it doesn’t look like it’s possible with our Plesk access. This support article on Plesk indicates we can do it on a per-domain instance, however this options isn’t present.

However, URLs being case-sensitive are normally a good thing. What is the root issue you’re having? There may be another way to solve it.

Link to comment
Share on other sites

The root issue would be: let's say I have a url such as test.helioho.st/newvocab.html

and somebody innocently goes to test.helioho.st.org/NewVocab.html, I don't want them to get a 404 error simply because they used mixed case on in the URL; etc. This already happened to my in my testing before I realized that helio hosting was case sensitive by default.

I think there is a reason that some web servers don't have case sensitive URLs by default (I think windows based servers do not), and also there is a reason that linux/unix based servers let you turn this off, so I'm hoping to find a way to turn this off at the domain level.  

 

Link to comment
Share on other sites

Linux servers actually do not let you turn this off. The reason its possible is because someone made a module for apache that lets Apache locate files without respect to case.

The case-sensitivity comes from the fact that the file systems used by linux/unix are inherently case sensitive. As a result, URLs of stuff served by a web server running on such a system is also case sensitive. Windows servers are not case sensitive because Windows file systems (NTFS and FAT) are not case sensitive.

The typical way to handle this is to just design your site to use all lower case filenames, or if you insist on caps to use a specific pattern of capitalization like editDataFile.php and move on. 

Link to comment
Share on other sites

Hi @glennbob,

Technically it is possible, though our root admins would have to analyze your request to enable mod_speling since it could affect the server performance.

With that module enabled, you would have to create a .htaccess file with the following content:

<IfModule mod_speling.c>
	CheckSpelling On
	CheckCaseOnly On
</IfModule>

Please let us know if you want to check if this module could be enabled so I can escalate your request to our root admins.

 

You can also use mod_rewrite to change all your URLs to lowercase by creating a .htaccess with the following content:

RewriteEngine On
RewriteCond expr "tolower(%{REQUEST_URI}) =~ /(.*)/"
RewriteRule [A-Z] %1 [R=301,L]

Examples using mod_rewrite:

https://johnny.kairion.eu.org/rewrite/InDex.hTmL (it will automatically be changed to https://johnny.kairion.eu.org/rewrite/index.html)

https://johnny.kairion.eu.org/rewrite/TeSt/ (it will automatically be changed to https://johnny.kairion.eu.org/rewrite/test/).

Please note that my examples will only work with subdirectories/files under the rewrite directory, since my .htaccess file is under (inside) that directory. Also, all directories and files should have their names in lowercase, since the rewrite code expects it to be like that to change any URL to full lowercase.

 

17 minutes ago, glennbob said:

I think there is a reason that some web servers don't have case sensitive URLs by default (I think windows based servers do not)

Basically, web servers running on Windows, because its file system does not support case sensitive file names.

17 minutes ago, glennbob said:

there is a reason that linux/unix based servers let you turn this off 

Basically, to allow compatibility with Windows systems in special cases.

Link to comment
Share on other sites

44 minutes ago, Kairion said:

You can also use mod_rewrite to change all your URLs to lowercase by creating a .htaccess with the following content:

RewriteEngine On
RewriteCond expr "tolower(%{REQUEST_URI}) =~ /(.*)/"
RewriteRule [A-Z] %1 [R=301,L]

Examples using mod_rewrite:

 

This might be the simplest solution. I will explore this. Thank you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...