Reputation: 1753
I have a wordpress website with ssl implemented. The website is working properly at https://domain.com. I want to redirect all the traffic from http://domain.com to https://domain.com. I googled about this and changed my .htaccess to following:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
The redirection is not working. I have tried plugins like Easy HTTPS redirection, Wordpress HTTPS, etc but still it is not working. Can someone please help me out on this. Also i would like to add that when I try to visit http://domain.com it does not connect. Thanks in advance.
Upvotes: 0
Views: 1786
Reputation: 11
Make sure that you define the WP_SITEURL and WP_HOME at wp-config.php
define('WP_HOME','https://yourdomain.com');
define('WP_SITEURL','https://yourdomain.com');
And add this condition to check if the https at wp-config.php
if ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' == $_SERVER['HTTP_X_FORWARDED_PROTO'] ) {
$_SERVER['HTTPS'] = 'on';
}
Upvotes: 1
Reputation: 1
Try moving the RewriteBase below the http redirect and into the wordpress section. It solved my the issue for me.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Upvotes: 0
Reputation: 1729
Make sure you have changed the settings in wp_options table, siteurl and home to include
option_name option_value
siteurl https://<your domain>
home https://<your domain>
Upvotes: 1
Reputation: 3401
You shoudn't need a plugin to do this...
Try with this little change in your .htaccess
's RewriteRule:
RewriteCond %{HTTPS} off
RewriteRule ^.*$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Upvotes: 1
Reputation: 61
To redirect all the traffic from http://.com to https://.com i use this plugin ( works always for me): https://wordpress.org/plugins/wp-force-ssl/
Upvotes: 0