3
我使用的.htaccess这个代码,但它不是working.and没有出现错误如何URL重写HTTP到https
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{localhost}%{REQUEST_URI} [R=301,L]
我使用的.htaccess这个代码,但它不是working.and没有出现错误如何URL重写HTTP到https
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{localhost}%{REQUEST_URI} [R=301,L]
您使用的是%{localhost}
问题,因为没有所谓的%{localhost}
这样的变量。
试试这个规则在你的根的.htaccess或Apache服务器配置:
RewriteEngine On
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{SERVER_PORT} !=443 [OR]
RewriteCond %{ENV:protossl} !=s [OR]
RewriteCond %{HTTP:X-Forwarded-SSL} !=on [OR]
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule^https://%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
要改写自动有你的网址从http到https,简单地做到这一点,改变domain.com到您的域名TLD:
RewriteEngine On
RewriteCond %{SERVER_PORT} !443
RewriteRule ^(.*)$ https://www.domain.com/$1 [r=301,nc,L]
请改变你的标签'.htaccess' – HddnTHA 2014-09-20 06:52:01
@HddnTHA哪些变量? – user3853169 2014-09-20 07:01:24
你的问题有'php'标签,但它不包含有关php的任何内容。 – HddnTHA 2014-09-20 07:03:10