2015-07-10 101 views
0

在我的wordpress安裝中,我有一個特殊頁面,它從外部數據庫獲取數據。Wordpress中的特殊重寫規則

如果我打開http://localhost/o-b/comm/?id=123 everthing正常工作。但是,如果我打開http://localhost/ob/comm/123 Wordpress導致我到404錯誤頁面。我已經用在線重寫規則檢查檢查了RewriteRule,並且我得到了一個匹配。

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

RewriteRule ^ob/comm/(.*)$ o-b/comm/?id=$1 #this line is killing me 

RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
</IfModule> 

任何提示呢?

+0

忘了說了:所有其他重寫喜歡的永久鏈接等工作。 – cosmokramer

+0

我想你需要在規則的末尾添加'[L]'標誌。 –

回答

0

轉到WordPress儀表板中的設置下的固定鏈接選項,找到執行此操作的選項。

不知道這裏變量「id」是什麼意思,因爲它通常是「p」,如果這是自定義的帖子類型,則需要爲它重新打開url重寫。

在這裏閱讀更多: https://codex.wordpress.org/Using_Permalinks