I’m trying to redirect xyz.com to https://xyz.com
My code
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^xyz.com$
RewriteRule ^(.*)$ https://xyz.com/$1 [R=301]
RewriteRule ^index.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*.php)$ $1 [L]
RewriteRule . index.php [L]
RewriteRule ^(.*/)?sitemap.xml wp-content/sitemap.php [L]
# END WordPress
and also i try the following code
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www.)?(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
it shows this error
The page isn’t redirecting properly
actually it’s a WordPress site.
how to solve that problem?
Thanks in advance
Have your rule as this:
Also make sure in your WP permalink settings you have
home
andsite
URL reflectinghttps://xyz.com/
Please add the below code to your
.htaccess
file to redirect whole site to https.If you want to redirect selected pages, then rewrite rule as below.
If you prefer plugin, you can use this plugin: https://wordpress.org/plugins/https-redirection/.
Try this it’s working for me
please add this code in to your .htaccess file and let me know things.
this code work fine in my site also please check you have SSL certificate in your hosting provider.
check this link http://kuldipmakdiya.wordpress.com/2014/10/14/redirect-htaccess-to-ssl-is-not-working/