我需要实现2个重定向。
我想将example.com/subdir
重定向到example1.com/subdir然后我想将example.com/
上剩下的所有内容重定向到example2.com/index.html
我尝试了以下方法,但没有找到我的解决方案:
redirect 301 /subdir https://example1.com/subdir
redirect 301 / https://example2.com/index.html
最终发生的是所有内容都重定向到https://example2.com/index.html
谢谢!
附加
我需要https://example.com/subdir重定向到https://outlook.office365.com/owa/calendar/
然后,https://example.com上的所有内容/任何内容都需要重定向到example1.com的新站点
换句话说,example.com上的所有内容都需要重定向到一个新的压缩页面example1.com/index.html,除了example.com/subdir需要转到outlook/office 365。
您可以尝试以下,写与显示的样本。请确保在测试url之前清除浏览器缓存。
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^(?:www.)example.com [NC]
RewriteRule ^(subdir)/?$ https://outlook.office365.com/owa/calendar [R=301,NE,L]
RewriteCond %{HTTP_HOST} ^(?:www.)example.com [NC]
RewriteRule ^ https://example1.com/your_single_page.html [R=301,NE,L]