浏览整个网站,无法找到解决我问题的方法。
我的整个网站都是https://
,http://www.domain
,http://domain
会重定向到https://domain.com,然后整个网站将以https://smoothly
运行。
我现在只需要创建我的主页,http://因为我使用的脚本不会加载到chrome上,因为它使用了一些http://链接,我无法更改脚本所以我唯一的解决方法就是将我的主页设为http://然后其余内容(包括所有内页)自动成为https://
这就是我的htaccess的样子:
rewriteengine on
#rewritecond %{HTTP_HOST} ^www.domain.com$
#rewriterule ^$ "http\:\/\/domain\.com\/" [R=301,L] #528a28c9588af
RewriteCond %{HTTPS} on
RewriteRule (^$) http://%{SERVER_NAME}%{REQUEST_URI} [R=302,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
#RewriteCond %{SERVER_PORT} 443
#RewriteRule ^(|/)$ http://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
rewritecond $0 !^(index\.php|front_assets|images|captcha|css|js|editor|assets|robots\.txt)
rewriterule ^.*$ index.php [L]
This is pretty bad but some of it works, it redirects the http://www homepage to http:// which is what i want, it also redirects https:// www. domain .com to http:// homepage which is what i want, but when i go to https:// domain .com it redirects to http:// homepage but gives a redirect loop version.
Basically what I want is to make http:// www . domain .com, https:// domain .com and https:// www . domain.com to redirect to http:// domain.com
and then once we're on http:// domain .com, if you click on anything or go to any inner pages I want it to show the https version, i just need the homepage to be http: //
任何人都可以帮忙,在没有运气的情况下试图这样做。
提前致谢
答案 0 :(得分:0)
请尝试以下规则:
RewriteCond %{HTTPS} on
RewriteRule ^$ http://%{HOST_NAME}/ [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^.+$ https://%{HOST_NAME}%{REQUEST_URI} [L,R=301,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $0 !^(index\.php|front_assets|images|captcha|css|js|editor|assets|robots\.txt)
RewriteRule ^.*$ index.php [L]