.htaccess 将所有内容重定向到新域,但一个 URL 除外



我是 301 使用此代码将所有内容从http://something.org/*重定向到https://something.com/*...

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) https://www.something.com/$1 [R=301,L]
</IfModule>

我正在尝试添加此 URL http://something.org/registration/service重定向到http://www.something.com/registration/service的异常(不是像一般规则那样的 HTTPS(。尝试这样做以从一般规则中排除此 url,它可以工作,但我不知道如何添加规则以将此排除重定向到其他内容:

<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^/registration/service
    RewriteRule (.*) https://www.dewesoft.com/$1 [R=301,L]
</IfModule>

将你的重写Cond替换为:

RewriteRule ^registration/service http://example.com%{REQUEST_URI} [NE,L,R]

最新更新