1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How To Redirect HTTP to HTTPS on Wordpress?

Discussion in 'Site & Server Administration' started by mr.rob, Nov 23, 2018.

  1. #1
    Hey everyone, I'm definitely a newb when it comes to internet backend stuff wanted to see if you guys could shed some light for me.

    On the backend of Wordpress I changed my general settings for both Site Address URL and Wordpress Address URL from http to https. It seems to have worked but if I type in the URL with http it doesn't automatically redirect to https like I thought it would.

    Basically HTTP & HTTPS protocols works apart and return the same page content.

    My friend tells me I should use the following code in my .htaccess to set up a 301 redirect:
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https: //%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    Is this accurate info and should I use this code?

    Thanks for your input.
     
    mr.rob, Nov 23, 2018 IP
  2. Steven74

    Steven74 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Yes, you can use this code. Alternatively, you could also use:

    RewriteEngine on
    RewriteCond %{SERVER_PORT} ^80$
     
    Steven74, Nov 23, 2018 IP
  3. Steven74

    Steven74 Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    I'm sorry, I was unable to post the last line but it's the same one as yours. For some reason, the forum won't let me post it.
     
    Steven74, Nov 23, 2018 IP
  4. nettacompany

    nettacompany Well-Known Member

    Messages:
    40
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    145
    #4
    https://tr.wordpress.org/plugins/really-simple-ssl/ you can try it.
     
    nettacompany, Mar 27, 2019 IP
  5. LyraHosting

    LyraHosting Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #5
    open .httaccess and write that

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTPS} off
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    Code (markup):
     
    LyraHosting, Oct 4, 2019 IP
  6. nshep

    nshep Greenhorn

    Messages:
    66
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    13
    #6
    nshep, Oct 7, 2019 IP
  7. beserious

    beserious Active Member

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    58
    #7
    If you want to change from HTTP to https then make sure that your server has an SSL certificate installed and activated for your domain. Nowadays most of the shared hosting providers offer free SSL but if you are using hosting which does not offer free SSL then you should purchase one or you can go with free SSL providers like Cloudflare or letsencrypt.

    Another thing is all the links in your theme must use https for the resources. otherwise, the browser will give a warning to the visitor. If you do not want to modify your code then you can use this plugin to sort your theme links issue.
    https://wordpress.org/plugins/ssl-insecure-content-fixer/
     
    beserious, Nov 27, 2019 IP