【问题标题】:How htaccess rewrite domain to another domainhtaccess 如何将域重写到另一个域
【发布时间】:2017-03-07 07:46:57
【问题描述】:

我正在尝试使用 htaccess 更改域的名称,这是我想要的: http://olddomaine.com/subname/*http://newdomaine.com/* 我正在使用这个解决方案,但是页面只是加载而没有任何内容:(:

Options +FollowSymlinks -MultiViews
RewriteEngine On

RewriteCond %{HTTP_HOST} !^olddomaine\.com$

RedirectMatch 301 ^/subname/$ http://newdomaine.com/

#RewriteRule (.*) http://newdomaine.com/$1 [R=301,NC]
#RewriteRule ^subname/(.*)  http://newdomaine.com/$1 [R=301,NC]

【问题讨论】:

    标签: .htaccess mod-rewrite subdomain url-redirection


    【解决方案1】:

    您正在将 mod-rewrite 与 mod-alias 混合使用。两者都适用于您所需的重定向,但您应该只使用一种方法。

    以下使用mod-alias

    Options +FollowSymlinks -MultiViews
    RedirectPermanent /subname http://newdomain.com/
    

    以下是使用mod-rewrite

    Options +FollowSymlinks -MultiViews
    RewriteEngine On
    RewriteRule ^subname(?:/(.*))$ http://newdomain.com/$1 [R=301,L]
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-05-04
    • 1970-01-01
    • 1970-01-01
    • 2014-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-26
    相关资源
    最近更新 更多