使用 .htaccess 根据文件路径的一部分重定向到新域?
Redirect based on part of filepath to new domain with .htaccess?
我正在尝试弄清楚我的 .htaccess 应该如何执行以下操作:
获取任何看起来像
的 url
{the protocol}thedomain.co.uk/home/{rest of uri}
或
{the protocol}www.thedomain.co.uk/home/{rest of uri}
重定向至
{the protocol}subdomain.thedomain.co.uk/home/{rest of uri}
应该很简单,但我只有 5 岁孩子的正则表达式技能。任何帮助表示赞赏。
将其添加到站点根目录的 .htaccess 文件中。
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?thedomain\.co\.uk [NC]
RewriteCond %{HTTPS}s ^on(s)|off
RewriteRule ^(home/.*)$ http%1://subdomain.thedomain.co.uk/ [R=301,L]
我正在尝试弄清楚我的 .htaccess 应该如何执行以下操作:
获取任何看起来像
的 url{the protocol}thedomain.co.uk/home/{rest of uri}
或
{the protocol}www.thedomain.co.uk/home/{rest of uri}
重定向至
{the protocol}subdomain.thedomain.co.uk/home/{rest of uri}
应该很简单,但我只有 5 岁孩子的正则表达式技能。任何帮助表示赞赏。
将其添加到站点根目录的 .htaccess 文件中。
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?thedomain\.co\.uk [NC]
RewriteCond %{HTTPS}s ^on(s)|off
RewriteRule ^(home/.*)$ http%1://subdomain.thedomain.co.uk/ [R=301,L]