2009-09-01 89 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] 

希望这可以帮助别人!