重定向到https

时间:2018-10-31 08:25:06

标签: .htaccess redirect https subdomain

前一段时间,我不得不将网站上的所有页面重定向到https并屏蔽路径的一部分(从www.mywebsite.com/dir/index.php到www.mywebsite.com/index.php)。

我设法使用以下方法(在一些帮助下:. htaccess - redirect to subfolder with HTTPS while hiding URL part):

Options +MultiViews
RewriteEngine On
RewriteCond %{SERVER_PORT} 80 

RewriteCond %{HTTPS} !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

RewriteCond %{REQUEST_URI} !/winfo/ [NC]
RewriteRule .* /dir/$0 [L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

不幸的是,我刚刚注意到现在所有子域都不再可用。 每次尝试访问一个子域(例如subdomain.mywebsite.com)时,我都会重定向到www.mywebsite.com/dir/subdomain/index.php。

很显然,由于那里没有子域文件夹,因此失败。

我的根结构是这样的:

/mywebsitedirectory
/mysubdomain1directory
/mysubdomain2directory
......................

我一直在设法解决这个问题,但到目前为止还没有运气。 关于如何解决它的任何想法?

0 个答案:

没有答案
相关问题