将所有请求重定向到另一个域的简单 .htaccess
将此文件命名为 .htaccess 并放置在你要从中重定向的域的根目录中。
将 my-new-domain.com 替换为你要重定向到的域。(记住在 RewriteCond 行中,域中的 . 需要用反斜杠转义!)
.htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} !^my-new-domain\.com$ [NC]
RewriteRule ^(.*)$ https://my-new-domain.com/$1 [L,R=301]Check out similar posts by category:
Webserver
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow