2009-09-01 85 views
1

我曾經有我的固定鏈接到標準格式,如http://example.com/?page_id=2。現在我改變了這一點,在wp根文件夾中的httpd.ini文件中使用ISAPI重寫。這是行得通的,但我需要將舊的page_id = x樣式頁面重定向到當前永久鏈接,鏈接形式爲http://example.com/subject重定向舊的永久鏈接(page_id = x)wordpress

我看過RedirectPermanent關鍵字等,但似乎沒有真正的工作。我的頁面數量非常有限,所以我指定所有page_ids的列表並不是真正的問題。任何人都知道我可以做到這一點?

回答

1

找到它。也許不是最好的伎倆在書中,但在這裏有雲:

RewriteRule /(.*)?page_id=3(.*) /company_profile [L,I,RP] 

我的完整的httpd.ini文件現在是:

[ISAPI_Rewrite] 
RewriteEngine On 

RewriteBase/
RewriteCond ${REQUEST_FILENAME} !-f 
RewriteCond ${REQUEST_FILENAME} !-d 
# For special Wordpress folders (e.g. theme, admin, etc.) 

RewriteRule /wp-(.*) /wp-$1 [L] 
RewriteRule /google(.*) /google$1 [L] 

#Rewrites for permanently moved pages (page_id=x): 
RewriteRule /(.*)?page_id=3(.*) /company_profile [L,I,RP] 

# For all Wordpress pages 
RewriteRule ^/$ /index.php [L]  
RewriteRule /(.*) /index.php/$1 [L] 

希望這可以幫助別人!