I want to make URL insensitive
using URL Rewriting
in php.
I am new to php so I don't have that much idea but I got some code for URL Rewriting
to remove .php from url. I have written it in .htaccess
file.
What changes I will need to do in this code to make URL completely insensitive ?
For example, if url is hello.php then It should work as Hello.php , hello, Hello, HELLO etc.
My Code :
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L] [NC,L]
You can use this rule to handle case insensitive requirement:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_URI}\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.