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?
    SEMrush
    Thanks for your input.
     
    mr.rob, Nov 23, 2018 IP
    SEMrush
  2. Steven74

    Steven74 Peon

    Messages:
    5
    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:
    5
    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