【问题标题】:301 redirect append string after redirection301重定向后重定向附加字符串
【发布时间】:2011-12-16 10:14:34
【问题描述】:

我正在使用 htaccess 文件进行永久重定向,但重定向后默认附加在 url 中的附加查询字符串。

我的 htaccess 代码是

Redirect 301 /text/text2 http://www.mysite.com/text/text2-another-text3

结果是 http://www.mysite.com/text/text2-another-text3?/text/text2

我正在为我的应用程序使用 codeigniter

谢谢

【问题讨论】:

    标签: php .htaccess codeigniter


    【解决方案1】:

    请检查路由部分,因为它们是默认控制器/功能...

    【讨论】:

    • 我已经检查了我的路由文件,如果我使用 htaccess 进行永久重定向,我不知道为什么会发生这种情况。
    【解决方案2】:

    尝试将以下内容添加到您的 .htaccess 文件中。末尾的? 会阻止传递查询字符串参数。

    RewriteEngine on
    RewriteBase /
    
    RewriteRule ^text/text2$ http://www.mysite.com/text/text2-another-text3? [R=301,L] 
    

    【讨论】:

    • 感谢您的回复,但问题依旧。我仍然得到查询字符串部分
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-30
    • 1970-01-01
    • 2016-11-21
    • 1970-01-01
    • 2010-11-06
    • 2017-04-13
    • 2017-10-04
    相关资源
    最近更新 更多