htaccess rewrite hide .php and also flatten query string on one particular url
I have checked various topics and nothing caught my eyes. This is开发者_如何学JAVA what am trying to do ..
It's a small site and with only few pages all in my root /mobile folder. So I decided to modify h*p://example.com/mobile/academics.php to h*p://example.com/mobile/academics (without the trailing slash)
RewriteRule ^([^.]+)$ $1.php [NC,L] - Works fine.
But I have http://example.com/mobile/program.php?p=ams which I want to convert as http://example.com/mobile/program/ams . I tried this :
RewriteRule ^/program/([^/]+)$ program.php?p=$1 - Makes no effect. Browser keeps looking for /program/ams.php
How to have both rules coexist? I have query string only on program.php . Any help is appreciated. I am sorry if this has been answered before. I searched for quite sometime and couldn't find any.
Thanks, Vik
use
RewriteRule ^/?program/([^/]+)$ program.php?p=$1
精彩评论