【问题标题】:301 redirection in the htaccess file, url with "question mark"htaccess 文件中的 301 重定向,url 带有“问号”
【发布时间】:2016-10-11 12:08:50
【问题描述】:

我想在 htaccess 文件中做一个 301 重定向,重定向的 url 有一个问号

网址重定向:

被重定向到**新的以下网址:

谁能给我在 htacess 文件中添加的行吗?

提前感谢您的任何回复。

帕特里克

【问题讨论】:

    标签: apache .htaccess redirect


    【解决方案1】:

    您可以使用以下规则

    RewriteEngine on
    
    RewriteCond %{THE_REQUEST} /index\.html\?target=page_100.\html [NC]
    RewriteRule ^ /new.html? [L,R=301]
    

    这将重定向请求

    • /index.html?target=page_100.html

    • /new.html

    规则目标末尾的 ? 对于从新 url 中丢弃旧查询字符串很重要。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-08-29
      • 1970-01-01
      • 2014-01-06
      • 2021-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多