【问题标题】:Rewrite/redirect aspx with specific quesry string to specific wordpress page将带有特定查询字符串的 aspx 重写/重定向到特定的 wordpress 页面
【发布时间】:2012-07-25 17:50:04
【问题描述】:

我已经搜索过了,但找不到可行的解决方案...

我已经将一个站点从 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 捕获查询字符串...

【问题讨论】:

    标签: asp.net wordpress .htaccess rewrite


    【解决方案1】:

    我会试试下面应该做的:

    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]
    

    只需修改部分以匹配您的其他网址

    我一直发现这个工具对重定向很有用

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

    【讨论】:

    • 你。是。 A. 血腥的。天才!非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-06
    • 1970-01-01
    • 2015-12-13
    • 2013-10-22
    • 2019-01-15
    • 1970-01-01
    相关资源
    最近更新 更多