使用具有特定域的 .htaccess 重定向到 HTTPS

编程入门 行业动态 更新时间:2024-10-15 22:22:50
本文介绍了使用具有特定域的 .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

本文发布于:2023-11-01 13:30:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549454.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   htaccess   HTTPS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!