Question
How to avoid case-sensitive URLs in Plesk when:
-
The file
index.html
exists under the websiteexample.com
home directory; -
The file
index.html
is opening correctly via the browser in the following way:http://example.com/index.html
while the opening of
http://example.com/iNDeX.htML
leads to the following error
404 error (Not Found)
Answer
Warning: mod_speling works only for paths which are physically present on a file system and it is not compatible with websites which are using mod_rewrite
to process URLs.
Use mod_speling.so
Apache module:
Enable this module for a specific domain:
-
Go to Domains > example.com > Apache & nginx Settings > Additional Apache directives;
-
Add the following rows to the fields Additional directives for HTTP and Additional directives for HTTPS:
-
For Red Hat-based OSs:
LoadModule speling_module /usr/lib64/httpd/modules/mod_speling.so
<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule> -
For Debian-based OSs:
LoadModule speling_module /usr/lib/apache2/modules/mod_speling.so
<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule>
-
-
Click OK.
Enable this module for all domains:
-
For Red Hat-based OS's:
-
Connect to the server via SSH;
-
Create a backup of the Apache configuration file
/etc/httpd/conf/httpd.conf
:
# cp /etc/httpd/conf/httpd.conf{,.bak}
-
Edit file
/etc/httpd/conf/httpd.conf
to add the following rows:# vi /etc/httpd/conf/httpd.conf
LoadModule speling_module /usr/lib64/httpd/modules/mod_speling.so
<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule> -
Reload the Apache service:
# service httpd reload
-
Make sure that spelling module was loaded:
# httpd -M | grep speling_module
speling_module (shared)
-
-
For Debian-based OS's:
-
Connect to the server via SSH;
-
Create a backup of the Apache configuration file
/etc/apache2/apache2.conf
:# cp /etc/apache2/apache2.conf{,.bak}
-
Edit file /etc/apache2/apache2.conf to add the following rows:
# vi /etc/apache2/apache2.conf
LoadModule speling_module /usr/lib/apache2/modules/mod_speling.so
<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule> -
Reload Apache service:
# service apache2 reload
-
Make sure that spelling module was loaded:
# apache2ctl -M | grep speling_module
speling_module (shared)
-