Reputation: 41
How do I remove or hide php extension? using .htaccess?
2 Example URL :
http://localhost/folder/test.php?id=1&company=ABC&address=AAAAA
http://localhost/folder/test2.php?username=abcd
Thank You
Upvotes: 0
Views: 83
Reputation: 4066
Add this code in .htaccess
for html
and php
extension
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L] //for php extension
RewriteRule ^([^\.]+)$ $1.html [NC,L] //for html extension
for query string add these lines Try this
RewriteRule ^(folder)/(\d+)/([^/.]+)$ test.php?id=$1&company=$2&address=$3 [L]
Try This
RewriteRule ^(folder)/(\d+)/([^/.]+)$ test?id=$1&company=$2&address=$3 [L]
Try this
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_0-9]+)$ test?id=$1&company=$2&address=$3 [L]
RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z_0-9]+)$ test2?username=$1 [L]
i have add every possible solution
Upvotes: 1