【问题标题】:Do redirect and add variable to URL through htaccess通过 htaccess 重定向并添加变量到 URL
【发布时间】:2013-10-14 17:33:55
【问题描述】:

我想让 htaccess 将 oranges.info 重定向到 example.com/about.html?=fruit

这是我的 htaccess 文件,不幸的是它只是进行重定向而不是添加变量。有任何想法吗?

Options +FollowSymLinks 
rewriteengine on
rewritecond %{HTTP_HOST} ^www.oranges.info$ [OR]
rewritecond %{HTTP_HOST} ^oranges.info$
rewriterule ^domainfolder\/(.*)$ "http\:\/\/example\.com\/about\.html$1?fruit" [R=301,QSA,L] 

Options -Indexes

【问题讨论】:

    标签: apache .htaccess mod-rewrite


    【解决方案1】:

    您的规则语法不正确:

    rewritecond %{HTTP_HOST} ^(www\.)?oranges\.info$ [NC]
    rewriterule ^ http://example.com/about.html?fruit [R=301,QSA,L]
    

    确保在不同的浏览器中进行测试。

    【讨论】:

    • 在 Internet Explorer 和 Firefox 中运行良好,但在 Chrome 中运行良好。有什么想法需要 Chrome 吗?
    猜你喜欢
    • 2010-12-15
    • 2011-09-04
    • 1970-01-01
    • 2017-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-19
    • 2012-03-12
    相关资源
    最近更新 更多