2012-07-27 83 views
0

我已经通过搜索,并不能找到一个可行的解决方案......重写/重定向与特定quesry串ASPX具体WordPress的页面

我从移植一个asp.net网站到PHP。按照指示,我将内部链接保留为.aspx的seo。对于静态页面以外的WordPress,没有查询字符串,我可以很好地工作吧:

RewriteEngine on 
RewriteRule ^testimonials.aspx$ /testimonials.php [NC,R=301] 

但是,我有一些链接,其中包括查询字符串......这些链接现在已经指向了当前内页wordpress安装。我怎样才能得到

myawesomesite.com/catalog.aspx?n=My%incredible%20product 

重定向到

myawesomesite.com/catalog/my-new-incredible-product/ 

myawesomesite.com/catalog.aspx?n=My%other%20product 

重定向到

myawesomesite.com/catalog/my-new-other-product/ 

等...(在目标,“目录'是wordpress安装的目录)

我试过各种东西,但我不是专家。我知道我需要做些什么来让apache的赶查询字符串...

回答

2

我给这个一去下面应该这样做:

RewriteCond %{QUERY_STRING} ^n=My(?:[\ +]|%20)incredible(?:[\ +]|%20)product$ [NC] 
RewriteRule ^catalog\.aspx$ http://www.myawesomesite.com/catalog/my-new-incredible-product/? [R=301,NE,NC,L] 

只需修改部分以符合您的其他URL

我一直觉得这个工具来重定向

http://seo-website-designer.com/HtAccess-301-Redirect-Generator

+0

您有用。是。 A.血腥。天才!非常感谢。 – 2012-07-27 14:55:24