WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 2 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

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.