WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to force SSL for all requests? Much like the option to use admin ssl, but for all requests, including the ones who are not logged in.

share|improve this question
up vote 1 down vote accepted

Here is a complete guide - Enable Complete support for SSL on Wordpress

share|improve this answer

A simple check for is_ssl() should do it:

add_action( 'plugins_loaded', 'wpse_2718_force_ssl' );

function wpse_2718_force_ssl()
    if ( is_ssl() )

        'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] 

But I would do this in .htaccess to catch images too:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

For ISS see this answer on Stack Overflow.

share|improve this answer

Add this rule to the top of .htaccess:

# This should be the first rule before other rules
<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{HTTPS} !=on
    RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# END Force SSL

This should be before WordPress' rules.

share|improve this answer

I've used Really Simple SSL to my all of clients sites and it works very fine. If you dont want to modify code, simply install this plugin and config it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.