将http重定向到https angularjs应用程序

时间:2017-07-18 12:52:59

标签: .htaccess

我的应用是角度js,它位于子域,如http://app.xyz.com我想将其重定向到https://app.xyz.com这里是我用来重定向的htaccess

RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteCond %{HTTP_HOST} ^((?!www\.)[^.]+)\.xyz\.com$
RewriteRule ^(.*)$ https://%1/$1 [L]

当网站第一次加载它工作正常但是当我重新加载时我每次都找不到页面错误

由于

1 个答案:

答案 0 :(得分:0)

这会将所有网址重定向到https.Try this

# Redirect all url to https #
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}