本文介绍了使用具有特定域的 .htaccess 重定向到 HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我目前有 2 个域可以访问我服务器上的同一个文件夹:metrikstudios 和 ziced.
I currently have 2 domains that access to the same folder on my server: metrikstudios and ziced.
我希望通过 metrikstudios 进入的用户被重定向到 metrikstudios 以及通过 ziced 不要重定向到 ziced.
I want the users that enter through metrikstudios be redirected to metrikstudios and the users that enter through ziced don't be redirected to ziced.
我目前在我的 .htaccess 上有这个
I currently have this on my .htaccess
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) %{HTTP_HOST}%{REQUEST_URI}谢谢
推荐答案你可以简单地添加另一个 RewriteCond 来检查主机是否是metrikstudios
You could simply add another RewriteCond to check if the host is metrikstudios
RewriteCond %{HTTP_HOST} ^metrikstudios [NC]它应该是这样的:
RewriteEngine On RewriteCond %{HTTP_HOST} ^metrikstudios [NC] RewriteCond %{HTTPS} off RewriteRule ^(.*)$ %{HTTP_HOST}%{REQUEST_URI}更多推荐
使用具有特定域的 .htaccess 重定向到 HTTPS
发布评论