开发者

htaccess rewrite hide .php and also flatten query string on one particular url

开发者 https://www.devze.com 2023-04-09 10:16 出处:网络
I have checked various topics and nothing caught my eyes. This is开发者_如何学JAVA what am trying to do ..

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号