如何将一个页面重定向到另一个页面,然后将所有剩余页面重定向到新站点

How to redirect one page to another and then all remaining pages to a new site

我需要实施 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 to redirect to https://outlook.office365.com/owa/calendar/

然后,everything/anything else on 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]