- Mar 22, 2013
- 8,716
- 10,282
So I have an old wordpress site, and recently I migrated hosting, and I noticed that my pages don't redirect from http to https. I don't think it was like this before, and I can't figure out how to fix it.
Only the homepage actually redirects properly. So if I visit http://mysite.com, it will automatically redirect to https://mysite.com. Also, all the links on the entire site are https by default. However, if I manually visit http:// for any page on the site except the hompage, it actually opens it in http:// and does not open it with https://
I tried multiple things I found online, adding in the .httacess file, but nothing works.
My .htaccess file is in the root folder of the site, it's not in the theme's folder (wp-content, themes, MyTheme). This is what's in it:
I want all pages to redirect to https://, even if I manually visit in http://
Any ideas?
Only the homepage actually redirects properly. So if I visit http://mysite.com, it will automatically redirect to https://mysite.com. Also, all the links on the entire site are https by default. However, if I manually visit http:// for any page on the site except the hompage, it actually opens it in http:// and does not open it with https://
I tried multiple things I found online, adding in the .httacess file, but nothing works.
My .htaccess file is in the root folder of the site, it's not in the theme's folder (wp-content, themes, MyTheme). This is what's in it:
Code:
# BEGIN WordPress
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/html "access plus 5 minutes"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresDefault "access plus 6 hours"
</IfModule>
<ifModule mod_headers.c>
Header set X-Endurance-Cache-Level "2"
</ifModule>
Options -Indexes
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/http:/mysite.com/wp-content/endurance-page-cache/ - [L]
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP_COOKIE} !(wordpress_test_cookie|comment_author|wp\-postpass|wordpress_logged_in|wptouch_switch_toggle|wp_woocommerce_session_) [NC]
RewriteCond %{DOCUMENT_ROOT}/http:/mysite.com/wp-content/endurance-page-cache/$1/_index.html -f
RewriteRule ^(.*)$ /http:/mysite.com/wp-content/endurance-page-cache/$1/_index.html [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} mysite\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/cpanel-dcv/[0-9a-zA-Z_-]+$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ https://mysite.com/$1 [R,L]
</IfModule>
# END WordPress
I want all pages to redirect to https://, even if I manually visit in http://
Any ideas?
Last edited: