• losrack

    (@carlos-jaramillo)


    Hi,

    I have an SSL certificate installed on my host and all, so far so good. Also I have forced woocommerce to https, so far so good also. most of my pages go to https. except “home” and “shop”

    Now I want also my home page to be on https right form the start.

    I have searched around but I am a little confused. since the info changes a bit depending on who writes it. I would like to do this without a plugin.

    I kind of know I have to edit my htaccess file, which looks like this.

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    I have read also writing wp-config.php file with this:
    define('FORCE_SSL_ADMIN', true);
    but I do not know if it is at the begining .. or some specific place, at the end?

    Any help would be appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,

    Sometimes it depends on your host – how your server works and everything is set up.
    I use this

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

    Nothing in wp-config.php – not necessary as .htaccess will redirect everything.

    Also don’t forget to rewrite your urls in General settings for https instead of http for both lines.
    Good idea is to check whole database with plugin https://wordpress.org/plugins/better-search-replace/ if some old http still exist and rewrite everything for https.

    Btw. in htaccess you will set just redirection, so if someone type url without https or it come from old links.

    Anyway for use that https, that everything is pointed there, you have to rewrite your urls in General settting.

    Thread Starter losrack

    (@carlos-jaramillo)

    Hi Peter,

    Since your code looks a lot shorter than mine, I just wanted to know if I have to replace the code, insert it somewhere … I just don´t know

    Also my urls in general settings after rewrite they keep going back to http when I check back or reload… is this a functions.php file thing?

    Thanks a lot by the way

    Hi Carlos,

    This code put above your code what is default WordPress .htaccess file. This don’t touch, keep it like that.
    So your .htaccess will be

    RewriteEngine On
    RewriteCond %{ENV:HTTPS} !on
    RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    I mean, in Settings – General: change your url for https in two columns
    WordPress Address (URL) and Site Address (URL) and save it.
    After that you will be loged out and when you will login again, your site will be https.
    Anyway some links what you use on site, or some css files or whatever can stay old with http, so then use mentioned plugin 🙂
    Btw. some backup before doing this can save you life 😉

    Keep in mind, that these .htaccess redirection will nothing change how your site works, just will redirect all http to https with code 301 (permanently)

    Changes these urls in General settings and save them will change http to https in your site. (so this is your moving ;))

    So do redirection as last step, first be sure, that your https works well (if some 404 error – not found experienced, clean your browser cache, if use on site … that too).

    After all if that redirection code will not work, the best way if you will contact your hosting provider for ask about it, bc. on specific server can be specific redirection rules, that is why you will find tons of different results while you search about that topic 🙂

    Thread Starter losrack

    (@carlos-jaramillo)

    Thank you so much

    … mmm something is wrong when I do that.

    I will contact my host and see what they say.

    Hi Carlos,

    Did you ever get this figured out?

    One of my sites keeps reverting back to http from https whenever I change it in the general settings.

    Thanks so much,

    Amanda

    Thread Starter losrack

    (@carlos-jaramillo)

    Hi,

    Do you still need help with this?

    just in case … I went thru a lot of trouble with this.

    I added this code at the beginning of my child’s functions php file.

    <?php
    
    update_option('siteurl','https://yoursite.com/');
    update_option('home','https://yoursite.com/');
    /**

    hope it helps

    Carlos, you definitely helped me a lot. Thanks so much for your reply.

    The site is now using https. I appreciate your help!

    Thread Starter losrack

    (@carlos-jaramillo)

    Glad I could help.

    Regards…

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘HTTP to HTTPS’ is closed to new replies.