重定向到子域.htaccess的问题

时间:2016-01-15 10:58:29

标签: apache .htaccess mod-rewrite redirect

我遇到.htaccess问题。我有两个网站,一个在主根文件夹,另一个在root / subdomain。

我有.htaccess处理子域名:

RewriteCond %{HTTP_HOST} ^sub\.domain\.com [NC]
RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^(.*)$ /sub.domain.com/ [R=301,L]

我遇到的问题是网址看起来像: https://sub.domain.com/sub.domain.com/

我想通过.htaccess隐藏sub.domain.com。

另外我想提一下http的一切正常。

你能帮帮我吗?

1 个答案:

答案 0 :(得分:0)

您能否尝试在子域.htaccess文件中添加以下代码并再次检查

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