I am working a website which is deployed on a Linux server. I have small changes to do on that. I have folder read
. The requirement is that if I enter the URL <
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
.
Hi not sure if this helps but this is the simple workabout i have used, it uses a very basic php page but it works for the site i needed it to.
Place this code in the htaccess file
AddType application/x-httpd-php .html .htm
ErrorDocument 404 /404.php
I have then created a php file wit the following..
<?php
$aurl = $_SERVER['REQUEST_URI'];
$lurl = strtolower($aurl);
if($aurl != $lurl){
header('location:'.$lurl);
} else {
header('location:/404.html');
}
?>
Basically it gets the referring url -> stores as $aurl
it then makes it lowercase -> stores as $lurl
if they are not matching it then trys to display the lowercase url ($lurl)
If that fails the page does not exist, the refering url is now the same ( $lurl == $aurl ) so it then redirects to a proper 404 page or can display some extra code..
Hi I got the solution finally. Placed the below code in /etc/httpd/conf/httpd.conf
.
LoadModule speling_module modules/mod_speling.so
<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule>
Then restart httpd:
sudo service httpd restart
And finally verify it is enabled:
sudo httpd -M | grep speling
That should yield speling_module (shared)
Thanks for the help for all..
First install speling_module.
Then include LoadModule speling_module modules/mod_speling.so
in httpd.conf file and then include
in httpd.conf, then restart httpd service using service httpd restart command.<IfModule mod_speling.c>
CheckSpelling On
CheckCaseOnly On
</IfModule>