【问题标题】:.htaccess redirect [duplicate].htaccess 重定向 [重复]
【发布时间】:2011-04-05 08:24:29
【问题描述】:

可能重复:
.htaccess redirect

如果我假设使用 .htaccess 文件,我会如何将人们从这个 URL:http://blog.twostepmedia.co.uk/win-traffic-with-charlie-sheen-and-the-yahoo-boss-api/ 重定向到类似http://www.twostepmedia.co.uk/blog/win-traffic-with-charlie-sheen-and-the-yahoo-boss-api/ 的东西

谢谢:)

【问题讨论】:

标签: .htaccess redirect


【解决方案1】:

最好在 blog.twostepmedia.co.uk 域的 .htaccess 中使用重写规则。

有点像

RewriteEngine on
RewriteOptions MaxRedirects=10 # this will just stop and bugs in the code causing a infinite loop
RewriteRule ^(.+)$ http://www.twostopmedia.co.uk/blog/$1 [R=301,NC]

重写规则会抓取 'blog.twostepmedia.co.uk/' 之后的任何内容并重写到新的 url。 [R=301,NC] 将此设置为永久重定向,这意味着您不会因搜索引擎蜘蛛的重复内容而受到惩罚。

希望有帮助:)

【讨论】:

    猜你喜欢
    • 2013-02-05
    • 2012-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-12
    • 1970-01-01
    相关资源
    最近更新 更多