• Need some .htaccess/wp-config.php advice here.

    How can I force a http connection for the entire WordPress front-end, while having a forced https access for the admin and login pages (back-end)?

    I tried the following:

    1. on top of the htaccess file:

    RewriteCond %{HTTPS} on
    RewriteCond %{REQUEST_URI} !^(login|wp-admin|wp-login.php)
    RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

    2. wp-config.php has these extra lines:

    define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
    define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
    define('FORCE_SSL_LOGIN', true);
    define('FORCE_SSL_ADMIN', true);

    The above unfortunately results in a redirect loop for the admin/login pages, while the front correctly redirects from https to http.

    Any advice how to get a correct working solution is appreciated.

The topic ‘Force http for front-end pages’ is closed to new replies.