2011-03-05 112 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]