2012-11-23 53 views
5

當固定鏈接已啓用時,我們可以重寫WordPress頁面/ghij以顯示頁面/faq的內容嗎?WordPress .htaccess不適用於重新編寫

我的頁面是example.com?page_id=70&category=Footage。啓用固定鏈接後,它顯示example.com/video-category?category=Footage。我希望它看起來像example.com/category/Footage

任何幫助,將不勝感激。

當前.htaccess

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /index.php [L] 
</IfModule> 
+0

顯示你的'.htaccess'代碼。 – StasGrin

+0

現在它是具有鹼性的wordpress htaccess的代碼 #BEGIN WordPress的 RewriteEngine敘述在 RewriteBase/ 的RewriteCond%{REQUEST_FILENAME}!-f 的RewriteCond%{REQUEST_FILENAME}!-d 重寫規則。的index.php [L] #END WordPress的 –

+0

我用重寫規則^類別/影片/ $?PAGE_ID = 70&類別=素材[QSA,L] 重寫規則^類別/影片/ $視頻類別?類別=素材[QSA,L]但它不起作用 –

回答

1
# BEGIN WordPress 
<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/

    RewriteCond %{QUERY_STRING} ^page_id=([0-9]*)&category=(.*)$ 
    RewriteRule ^(.*)$ /%1/%2? [R=301,L] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule . /index.php [L] 
</IfModule> 
# END WordPress 

作品。並重定向來自:
http://test.com/index.php?page_id=70&category=Footage
爲:
http://test.com/70/Footage



更新:

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


這條規則的作品和來自使得內重定向(不更改網址):
http://test.com/70/Footage
爲:
http://test.com/index.php?page_id=70&category=Footage

+0

是的,它正在工作,但我想重寫URL。我的意思是在瀏覽器中我想將它作爲domain.com/ghij,但是頁面請注意顯示faq頁面的內容 –

+0

@Pankajjarial ty out this one。 – StasGrin

+0

非常感謝它正在工作,但它沒有顯示http://test.com/index.php?page_id=70&category=Footage下的內容http://test.com/70/Footage只有URL正在發生變化。我希望http://test.com/70/Footage在瀏覽器中顯示爲url,並獲取http://test.com/index.php?page_id=70&category=Footage的內容。感謝您的關心。 –

0

我希望下面的插件將幫助您更

http://wordpress.org/extend/plugins/permalink-editor/

請檢查這個插件,它會重寫你想要的永久鏈接,而無需任何編碼知識。

+2

答覆。我的工作已經完成。是的,這個插件可以是有幫助的。 –