【问题标题】:Rewrite htaccess, redirect if a "+" exisit in the url like goo.gl重写htaccess,如果像goo.gl这样的url中存在“+”,则重定向
【发布时间】:2012-03-07 20:45:27
【问题描述】:

我的问题是:当 URL 包含像 goo.gl 和 bit.ly 这样的“+”时,如何重定向 URL 一个简单的例子 http://goo.gl/gogl+ 会被重定向到http://goo.gl/info/gogl

提前致谢。

【问题讨论】:

    标签: .htaccess redirect rewrite bit.ly goo.gl


    【解决方案1】:

    您只需要 .htaccess 文件中的这段代码:

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    
    RewriteRule ^([^\+]+)\+$ info/$1 [L]
    

    【讨论】:

    • 如果 OP 想要永久重定向,@Gerben 和 [L,R=301] 是正确的。
    • 非常感谢anubhava和Gerben,正是我需要的:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多