2014-11-24 198 views
1

我已經創建了自定義的WordPress壓縮文件頁面gumball.php,它可以處理基於URL的多個類別或標籤。Mod_rewrite更改網址

例如:

xyz.com/categories/gumball.php?categories=category1+category2 

將顯示分類爲類別1和類別職位檔案2

xyz.com/tags/gumball.php?tags=tag1+tag2 

將顯示標記爲標籤1和標籤現在2

職位檔案我堅持使用htaccess mod_rewrite將這些URL更改爲類似於使用方法here

xyz.com/categories/gumball/category1+category2 
xyz.com/tags/gumball/tag1+tag2 

如下

RewriteEngine On 
RewriteRule ^categories/gumball/?$ gumball.php?categories=$1 [L] 
RewriteRule ^tags/gumball/?$ gumbal.php?tags=$1 [L] 

回答

1

嘗試:

RewriteEngine On 
RewriteRule ^categories/gumball/(.*)$ /categories/gumball.php?categories=$1 [L] 
RewriteRule ^tags/gumball/(.*)$ /tags/gumball.php?tags=$1 [L] 

,但要確保他們之前任何WordPress的規則,你已經在你的文檔根目錄。