[Support request] Which 301 Redirect to use?

Home Forums General issues Which 301 Redirect to use?

This topic contains 5 replies, has 2 voices, and was last updated by  Mark Wolters 1 week, 3 days ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #89814 Reply

    Sascha

    Hello Really Simple SSL Team,

    first of all, thank you for your great work.

    There are two 301 redirects:

    * Enable WordPress 301 redirection to SSL

    and

    * Enable 301 .htaccess redirect

    Should I enable both? (Currently I am enabling both, in all sites, I am using this plugin)
    Is enabling both at the same time a problem?

    Kind Regards
    Sascha

    #89815 Reply

    Mark Wolters
    Keymaster

    Hi Sascha,

    we recommend to only enable one redirect at a time, however as you have experienced on your sites having two redirects active at the same time generally doesn’t lead to issues. We recommend to enable the .htaccess redirect option whenever possible since it’s the fastest one.

    Mark

    #89867 Reply

    Sascha Thattil

    Hello Mark,

    thank you for your great reply. Really helpful.

    What about the “Enable JavaScript redirection to SSL” is that also a stand-alone redirect. Or can we also keep it “unchecked” in the box?

    Kind Regards
    Sascha

    #90142 Reply

    Mark Wolters
    Keymaster

    Hi Sascha,

    you can keep the JavaScript redirect unchecked, it will do exactly the same as the .htaccess redirect: redirect all requests to your site to https://. It’s another method of issuing a redirect.

    Mark

    #90577 Reply

    Sascha

    Hello Mark,

    thank you for all your answers. I really appreciate this.

    Is there a redirect which redirects to https://www.
    What I have seen is that this code redirects to https:// as well as https://www.
    according to whether http:// or http://www. was entered into the browser bar.

    i.e. http:// redirects to https://
    and http://www. redirects to https://www.

    ——————

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

    ——————

    But I want it to redirect to https:/www. only
    Because that is my favorite domain.

    Could you share the modification to the code, so that it does this?

    Kind Regards
    Sascha

    #90590 Reply

    Mark Wolters
    Keymaster

    Hi Sascha,

    yes, that is possible. To do this you can add a piece of code to the .htaccess that will redirect all non-www requests to the www domain. This can be done in the following way:

    #redirect non-www to www
    
    RewriteEngine On
    
    RewriteCond %{HTTP_HOST} !^www\.
    
    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]

    What this does is that for all request that don’t have www in them (!^www), redirect to https://www. This code can be added above the current Really Simple SSL redirect rules in the .htaccess file.

    For a more detailed explanation about this see https://really-simple-ssl.com/knowledge-base/avoid-landing-page-redirects/

    Mark

    • This reply was modified 1 week, 3 days ago by  Mark Wolters.
Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Which 301 Redirect to use?
Your information: