0

我在我的门户上创建了 url-masking(url-mapping)。相同的 php 代码使用不同的 url 运行。我的门户链接是http://subdomain.domain.in(主链接),客户端 url 是http://www.client-domain.com。我想使用我的 .htaccess 文件将客户端 URL HTTP 重定向到 https。

从评论编辑:

RewriteEngine On 
RewriteCond %{HTTP_HOST} ^client-domain.in [NC] 
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI}/$1 [L,R=301] 
RewriteCond %{HTTP_HOST} ^mydomain.in [NC] 
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI}/$1 [L,R=301]
4

2 回答 2

0

您可以使用下面的代码相同

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

它会将您的网址 http 重定向到 https。

于 2019-01-11T06:48:21.360 回答
0

我的问题现在解决了。我已在 .htaccess 中添加了此代码,并且客户端的 url 与 HTTPS 一起使用。

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} www.client-domain.com [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}/$1 [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^my-domain.in [NC]
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI}/$1 [L,R=301]
于 2019-01-11T08:02:17.410 回答