Case Sensitive Urls in Apache

How do I make URLs case insensitive in Linux server

You can easily make the apache webserver ignore the case by using the mod_speling module, which is part of the standard apache distribution:

CheckSpelling On
CheckCaseOnly On

After restarting httpd you can access read as Read or READ or read.

Case sensitive urls in apache

You can easily done by using the mod_speling module, which is part of the standard apache distribution:

CheckSpelling On
CheckCaseOnly On

After restarting httpd you can access ABC as Abc or abc

I want to configure a Case InSenSitive web server

If you have access to the server config then there isn't really any need for .htaccess (unless this helps with distribution).

Try the following instead:

<VirtualHost *:80>
# Assuming you want to access the domain apex as well?
ServerName example.com
ServerAlias www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

# Case-Insensitive
CheckSpelling on
CheckCaseOnly on
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

And remove the .htaccess file.

Note the DocumentRoot (the root directory of your site) is /var/www/html. It is this directory that you need to grant access to in the corresponding <Directory> container. And is ordinarily the directory that the .htaccess file should be located (if enabled).

How would I make Apache case insensitive for urls and case sensitive for parameters

Use [NC] flag.

Use of the [NC] flag causes the RewriteRule to be matched in a
case-insensitive manner. That is, it doesn't care whether letters
appear as upper-case or lower-case in the matched URI.

Refrences:

https://httpd.apache.org/docs/2.4/rewrite/flags.html#flag_nc

Can I make an Apache running on Windows case-sensitive?

As far as I know you can't, but I will watch this question for other answers.

As a workaround, you say that you must develop on Windows. What about installing Linux in a Virtual PC. There are several free VM programs like VirtualBox and Microsoft Virtual PC. That way, you can match your development environment to your deployment environment.

Beyond that, I find that it is best to just make sure you use lowercase for everything, minimizing mistakes.

Case Insensitive URLs with mod_rewrite

CheckSpelling on

Matches files and directories. See the documentation for details.



Related Topics



Leave a reply



Submit