Avoiding Landing Page Redirects with SSL

I recently did a Google PageSpeed analysis of my website and received the following message:

Avoid landing page redirects

Your page has 2 redirects. Redirects introduce additional delays before the page can be loaded.

Avoid landing page redirects for the following chain of redirected URLs.

http://example.net/

https://example.net/

https://www.example.net/

Is there anything I can do about this (like modifying my htaccess file in some way), or is this an unavoidable consequence?

Here is my htaccess just in case:

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

您可以使用OR标志将两个重定向组合成一个

RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteCond %{HTTP_HOST} ^(www.)?(.*)$ [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
链接地址: http://www.djcxy.com/p/81966.html

上一篇: AudioRecord在Android L Developer Preview中记录间歇性声音

下一篇: 通过SSL避免着陆页重定向