如何通过 htaccess 将端口 80 重定向到其他位置?

How can I redirect port 80 to a different location through htaccess?

我在共享主机上,无法访问虚拟主机来为端口 443 和 80 定义单独的虚拟主机。

是否有一些简单的方法可以根据 htaccess 中的端口定义单独的 DocumentRoot 或位置?

我想在 https 上有一个 CMS (Wordpress) 运行 和 "temporary" 站点作为 http,它只有 2 个文件:index.html 和 contact.html.

假设您 index.html 和 contact.html 位于整个站点的文档根目录中,您可以尝试类似的操作:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(|index\.html|contact\.html)$ /temporary/ [L]

"temporary" 是您的 index.html 和 contact.html 文件所在的文件夹。