更新时间:2022-10-29 12:13:20
http://xxxx.com/是一个不可缓存的重定向到https://xxxx.com/
错误说明了一切。为了使其在浏览器中使用 R = 301
永久缓存:
RewriteEngine叙述上
的RewriteCond%{} HTTPS关闭
重写规则^的https://%{HTTP_HOST}%{REQUEST_URI} [L,R = 301,NE]
I am not at all familiar with htaccess. I need Htaccess code which will redirect http to https. I am using below code:
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
But main problem is, I am getting below suggestion, when trying to test server speed:
To speed up page load times for visitors of your site, remove as many landing page
redirections as possible, and make any required redirections cacheable if possible.
http://xxxx.com/ is a non-cacheable redirect to https://xxxx.com/
So, how to make it cacheable ?
http://xxxx.com/ is a non-cacheable redirect to https://xxxx.com/
Errors says it all. To make it permanently cacheable in browser use R=301
:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]