Redirect rules

Redirect to https not working

After you enable Really Simple SSL, by default a PHP redirect is activated, which is called wp 301 redirect in the plugin. If you notice your site can still be reached over http://, possibly the redirect does not work because the site is cached.

If you’re using Apache or litespeed, the best redirect method is the .htaccess redirect. As not all servers use Apache/litespeed, and not all servers support the detected .htaccess redirect rules, this is not enabled by default.

If you enable the .htaccess redirect in the settings (only apache) a redirect is activated that is executed even before the site is loaded, which is faster then the wp redirect.

Please make sure you know how to remove the .htaccess redirect if necessary. In a few cases the detected redirect does not work, resulting in a loop. You should then remove the .htaccess redirect using FTP.

On NGINX, if you want to do a redirect before WordPress is loaded like the .htaccess, you can add a redirect in the nginx.conf

Related Articles

10 Comments

  • Jessica Ong

    Hi Rogier,
    I am using Apache, and I have enabled 301 .htaccess redirect.
    It states this:
    The .htaccess redirect rules that were selected by this plugin failed in the test. The following redirect rules were tested:

    # BEGIN rlrssslReallySimpleSSL rsssl_version[2.5.22]

    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

    # END rlrssslReallySimpleSSL

    What does it mean?
    p/s: I am not IT background

    • Mark Wolters

      Hi Jessica,

      it could be your .htaccess file is not writeable. You can check the file permissions on the .htaccess file using an FTP client or add the rules manually. You can paste the entire block from # Begin.. to # END.. at the top of your .htaccess file.

      Mark

  • Simon

    Hi Mark

    I’m getting exactly the same error as Jessica and have pasted the entire block into .htaccess as you suggested. Debugging log states as follows:

    Options:
    * htaccess redirect
    * WordPress redirect
    * Mixed content fixer
    SERVER: apache
    SSL is enabled for this site
    ** Detecting configuration **
    plugin version: 2.5.22
    Already on SSL, start detecting configuration
    ssl type: LOADBALANCER
    ** Configuring SSL **
    testing htaccess rules…
    test page url, enter in browser to check manually: https://varc.org.uk/wp-content/plugins/really-simple-ssl/testssl/loadbalancer/ssl-test-page.html
    htaccess rules test failed with error: SSL: no alternative certificate subject name matches target host name ‘varc.org.uk’
    checking if .htaccess can or should be edited…
    .htaccess does not contain default Really Simple SSL redirect
    retrieving redirect rules
    converting siteurl and homeurl to https

    Any pointers would be warmly welcomed.

    Thanks

    Simon

  • Goran

    Hi, I installed and activated plugin but then I got err_too_many_redirects and when I tested home page link it showed 19 301 redirects. When I turn back to http everything is ok. Any suggeston?
    Thanks.

  • Kinga Bernhardt

    Hi,
    I am facing a problem what could not solve anyhow, with redirections.
    I want 301 redirect but it appears to be 302 even if in htaccess file it set to 301.

    What I would like: http://domain.co.uk, http://www.domain.co.uk and https://www.domain.co.uk to https://domain.co.uk.

    Using the test page I get:
    #SSL TEST PAGE#
    This page is used purely to test for SSL availability.

    #SERVER-HTTPS-ON# (on)
    #SERVERPORT443#

    #SUCCESFULLY DETECTED SSL#

    I have my .htaccess file:

    RewriteEngine On
    RewriteCond %{HTTPS} off [OR]
    RewriteCond %{HTTP_HOST} ^www\. [NC]
    RewriteRule ^ https://domain.co.uk%{REQUEST_URI} [R=301,L,NE]

    My site address in config file is set to:
    define(‘WP_SITEURL’, ‘https://domain.co.uk’);
    define(‘WP_HOME’, ‘https://domain.co.uk’);

    Please can you help?
    The http://domain.co.uk always return a 302 redirect instead of a 301. While http://www.domain.co.uk return a 302 and then a 301 to the required website.

    Thank you in advance,
    Kinga

    • Mark Wolters

      Hi Kinga,

      Really Simple SSL will only add a 301 redirect. It’s likely that the 302 redirect is added by something else. This could be a redirection plugin or redirect added in your hosting/CDN control panel. This 302 redirect has to be located and removed first.

      The define home- and siteurl can be removed from your wp-config.php file, Really Simple SSL had already changed those to https://.

      Mark

      • Kinga Bernhardt

        Hi Mark,

        Thank you for your reply.
        When I removed the home and site url the site was down, so I put it back.
        Also checked we don’t have CDN plugin, and the in the Redirection plugin there is no 302 redirect either(and all redirects is moved from there as they are in .htaccess file.).Checked the hosting panel and did not find redirection there either.
        Unfortunately I have no idea where this 302 redirect comes from.

        Thank you anyway for your time and help.

        Best,
        Kinga

        • Mark Wolters

          You can try to temporarily disable other plugins to see if that removes the 302 redirect, it must be coming from somewhere but it’s hard to say where from exactly without having access to the site.

          Mark

Leave a Comment