Reputation: 5870
I am working on a php project. I want to remove the ".php" from the URL. Also for -
www.mysite.com/gallery.php?gid=2008
I want like -
www.mysite.com/gallery/2008
How can I do this? I want to check it in local wamp server also.
Upvotes: 1
Views: 390
Reputation: 8250
Enable the mod_rewrite
in wamp
And add following lines in .htaccess
of your document root
RewriteEngine On
RewriteRule gallery/([0-9]+)/?$ gallery.php?gid=$1 [L]
If you want to remove all other PHP but retaining query string, if you have specifc way to handle query string you have write rules accordingly.
RewriteRule (.*)/? $1.php [QSA,L]
Upvotes: 2
Reputation: 6580
Here is an easy way to allow the URL without .php:
Options +MultiViews
Upvotes: 1
Reputation: 22956
Add the following in your .htaccess
RewriteEngine On
RewriteRule ^(.*)\.php\?(.*)=(\d+)$ /$1/$2
Upvotes: 0
Reputation: 19353
Have a look at this guide.. this should help you get started: http://corz.org/serv/tricks/htaccess2.php
Upvotes: 1