Skip to content
Advertisement

Want to rewrite php extension along with get parameter which does exist inside a folder not root

For example i have domain named as www.example.com , I have a url http://www.example.com/demo/content.php?gt=1 , I wanted to rewrite like http://www.example.com/demo/index.php , Here demo is sub directory , I am not sure how to do it , I tried in htaccess but gives me internal server error

Advertisement

Answer

I got your point add below code in your .htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^demo([^/]+)/index.php$ /demo/content.php?gt=$1  [QSA,L]
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement