WordPress Force HTTPS Redirection Without Plugin



Hey, Guys Most of them Using Plugin for Force HTTPS Redirection in Wordpress.Instead of Force SSL Redirect Plugin Use HTACCESS Rule for Force HTTPS Redirection.

  • Every time trusting Plugin is Not a Good Idea

  • Easy to add you can Find the HTACCESS File on your Hosting File Manager or Add via through Yoast SEO Plugin Yoast SEO > Tools > File Editor

Here’s the HTACCESS code for Force SSL Redirect (For HTTPS Redirection)

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

Important things to do after installing SSL (HTTPS) on your website
Does anybody know about this Error?
HTACCESS useful Rewrite Codes 2017
Best free 'trusted' SSL (https) certificate providers list for you!
Useful Code Snippets and Functions For your WordPress Site :tada:
Few doubts after Migrating my site from Http to https?
Switching from "HTTPS" (SSL) to "HTTP" (Important Things!)
After buying SSL certificate how to redirect my old urls and images

Awesome bro! We can also add this in the wp-config.php file right?

define(‘FORCE_SSL_ADMIN’, true);


No bro HTACCESS Rule is Enough bro :blush:


I was using Really Simple SSL Plugin, But this method seems nice and simple :slight_smile: Thanks for sharing it @mskian


Thanks, bro No More Extra Setups Now :relaxed: :blush:


I assume declaring this constant is required in some plugins to understand that your installation have SSL. So it is always better to define ‘FORCE_SSL_ADMIN’.


we are using that HTACCESS rule on our all blogs/websites Working fine Without any ISSUE

this below rule covers all folders and files

RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

No need to use

define(‘FORCE_SSL_ADMIN’, true);


Cool guys! But nothing’s wrong in trying both I guess, if your theme or blog still has some issues, we can enable the force SSL option in wp-config.php and see if it helps. :slight_smile:


I didn’t said it won’t work :smile: But declaring that variable might be needed some times. Simple logic, that constant developed for a purpose right ?


sometime HTTPS error due to sidebar banners/Widgets/Images/Affiliate LInks which having HTTP URL version.
Reupload the Favicon and Logo
Check you all sidebar Widgets If you Find HTTP version Replace it with HTTPS version bro.


Yesterday i added ssl. i used these .htaccess but its was not working for inner pages. They were not redirecting to https.

Then i used simple ssl plugin. and now working fine.


:fearful: then How it works for me? :rolling_eyes: After adding this Rule Clear Cache & Check the pages Sir

we are Using this rule only No issues from my Side


Aray bro. I am not saying ki you are wrong.

I just shared what i have done.



@pradeepkumar define (‘FORCE_SSL_ADMIN’, true); only enables SSL on WordPress login page i.e. wp-login.php and dashboard and not on full site.

Adding the code by mskian should work properly if one want to have ssl over full site including any direct urls to files and folders.

@prabhat This should have worked with you, maybe you had extra space which you didn’t notice…and if plugin is doing the job for you, then keep it :slight_smile:


maybe you had extra space ?

What you want to say sir ?:joy:

Actually i dont know much about coding. Last time something went wrong. kya batau.


“extra space” in the .htaccess code bro. :slight_smile:


For a newbie editing, HTACCESS is risky & if something wents wrong takes hours to recover it!
So I will suggest to use Really Simple SSL!
It is free does all the necessary steps


Hello All,

I would suggest changing your site settings and wordpress settings from http:// to https://

Make sure your host supports free SSL like Letsencrypt.

Once all is done install Really Simple SSL plugin.

It will handle your 301 redirection without messing up with the code :slight_smile:


I use this too and is very handy.


CloudFlare + LetsEncrypt + Really Simple SSL plugin + CloudFlare flexible SSL = <3