Case Insensitive URL's

How do I change my site’s visitors URL to completely lowercase?

Example:
If they type “example.com/Foldername/Pagename” it would show the page “example.com/foldername/pagename

I tried adding this .htaccess code, but it didn’t work after clearing cache and reloading. I did read that you might need to change something in the httpd.conf, but free hosting doesn’t let you access that correct?

RewriteEngine On
CheckSpelling On
CheckCaseOnly On

Yes, I only have one line of “RewriteEngine On”

Thanks!

or if it is important for you to parse the entry


Btw. why do you think someone would type an address
unless it is just a domain name ?

I doubt anyone will type a few / directories / structure /
especially when they don’t know what the right path is

2 Likes

Thanks for the link. I couldn’t get this one to work,

<IfModule mod_speling.c>
CheckSpelling on
</IfModule>

But this one worked instead (It was not the accepted answer)

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

Do you know why only the second works here? I do have a different IfModule for cache, and now I question if it is working.

I don’t think anyone would do that. I want to add this because someone (Defiantly not me, so don’t even think about blaming me), made half the links with the first letter uppercase and the other half with the first letter lowercase.

Correct! I definitely wouldn’t!

If you start typing URLs by hand, you will likely make a typo. Using uppercase letters when lowercase letters should be used is no exception.

You can’t stop people from shooting themselves in the foot by purposely typing incorrect URLs.

1 Like

Probably this mode mod_speling is not enabled in this configuration file httpd.conf from the server
(you have no control over it)

possible reason - impact on the server’s performance

1 Like

I mean when I am making links. Like sometime I would type

<a href”/Foldername/Pagename”>Link</a>

And sometimes I would type (Correctly)

<a href=”/foldername/pagename”>Link</a>

That’s what I though. So would my other IfModual for controlling cache still work?
Thanks

You can simply test it

put this on top of the .htaccess file

<IfModule mod_nameOfModHere>
deny from YOUR-IP-HERE
</IfModule>

refresh your website
if you are blocked mod_XY is active

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.