dshkmamau65777662 2015-04-10 10:34
浏览 52

所有链接都不会从http重定向到https

I have tried following;

If a user try to access my website http://test.com it will redirect to https://test.com but if a user try accessing internal page like http://test.com/test1 it doesn't redirect to https. I have tried following code in my .htaccess file.

RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Full .htaccess file

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

</IfModule>
  • 写回答

1条回答 默认 最新

  • duanqi6274 2015-04-10 10:38
    关注

    Instead of testing for !on test for off -

    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    
    评论

报告相同问题?