2011-03-05 113 views
0

我有指向原来的动态URL像这样几个改写网址:mod_rewrite的混乱

http://mysite.com/profile/edit/ => http://mysite.com/index.php?action=profile&sa=edit 

下面是htaccess的的重写规则:

RewriteRule ^([^/]*)/([^/]*)/$ /index.php?action=$1&sa=$2 [L] 

^使作品就好了。

现在我也有以下网址:

http://mysite.com/search/editorials/ => http://mysite.com/index.php?action=search&category=editorials 

它沿用了前重写规则公布上述改写:

RewriteRule ^([^/]*)/([^/]*)/$ /index.php?action=$1&category=$2 [L] 

^这是行不通的。我检查了$ _ SERVER数组,这是什么东西被重定向到查询字符串:

action=search&sa=editorials 

我已经在这一天为止,我已经试过各种教程,但没有运气。我如何得到这个工作?

任何帮助表示赞赏。谢谢。

回答

1

这两个重写是相互冲突的。你需要他们两个

重写规则^ 账号 /()/([^ /])/ $ /index.php?action=$1 & SA = $ 2之间建立某种类型的区别L]

重写规则^([^ /] )/([^ /])/ $ /index.php?action=$1 &类别= $ 2 L]

使参数一致并使用单个重写:

重写规则^([^ /] )/([^ /])/ $ /index.php?action=$1 & PARM1 = $ 2 L]