开发者

PHP Mod_Rewrite

I'm trying to use mod_rewrite to achieve the following rewrite:

From - http:/开发者_高级运维/ pre.domain.com/public/?project=Awesome

To - http:// pre.domain.com/project/Awesome

Can't seem to figure it out (despite reading through endless sites). Any help?


RewriteEngine On
RewriteRule ^project/(.*) /public/?$1 [L,NC]


RewriteEngine On
RewriteCond  %{QUERY_STRING}   ^project=(.*)$
RewriteRule   ^/public/         /project/%1/? [R,L] # strip off query string

You need to match against the query string using a RewriteCond.


Not sure you have your URLs around the right way so I think your are trying to do this:

RewriteRule ^project/(Awesome) /public/?project=$1 [L]
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜