[英]htaccess file to redirect to enforce https
I am trying to modify my .htacess file to enforce https, but because I already have some rules, I just appear to be breaking it. 我正在尝试修改.htacess文件以强制执行https,但是由于我已经有一些规则,因此我似乎正在打破它。 Can anyone help advise me?
谁能帮助我吗?
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php| (.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
I do this: 我这样做:
RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Use the RewriteEngine. 使用RewriteEngine。 This will force ssl.
这将强制ssl。
RewriteEngine On
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.