localhost中的mod_rewrite帮助

时间:2012-09-09 16:53:57

标签: mod-rewrite xampp localhost

我有一个xampp本地网站,我想将此网址localhost/mysite/frontend/article.php?article_id=something转换为localhost/mysite/frontend/article_id/something。我使用此重写规则

RewriteRule ^([A-Za-z0-9-]+)/?$ article.php?article_id=$1 [L] 

但是不对。有人可以帮忙。谢谢。

2 个答案:

答案 0 :(得分:0)

对于http:// localhost / mysite / frontend / article_id /如果.htaccess在mysite目录中并忽略某些内容

RewriteRule ^frontend/([^/]+)/ /mysite/frontend/article.php?article_id=$1 [L] 

答案 1 :(得分:0)

试试这个:

RewriteBase /mysite/frontend/
RewriteRule ^([A-Za-z0-9-]+)(/(.*?))?/?$ article.php?$1=$3 [L]