开发者

htaccess specify path for file

I'm trying to create a RewriteRule in an .htaccess file where, when a user tries to access: mp.php?id=2 the URL is rewritten to /private/items/mp.php?id=2

I tried different variations, based on this page: http://corz.org/serv/tricks/htaccess2.php The most recent of which is:

RewriteRule ^mp.php/(.*) /%1/private/items/mp.php?id=$1 [QSA]

Which, doesn't appear to wor开发者_如何学运维k, although, I think I'm missing something.


RewriteRule does not match in query strings, and can copy the query string to the rewriten path, so you only have to do this:

RewriteRule ^mp\.php /private/items/mp.php [QSA]

Which will result in mp.php?id=42 being rewritten to /private/items/mp.php?id=42

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜