• Resolved wolfnuka

    (@wolfnuka)


    Hello everyone, so i host my website with godaddy and bought a SSL certificate as well as a domain certificate, anyways, i was able to install the ssl on my website and is active, but i can’t manage to activate it on the URL bar, because is still opens my website using “HTTP” and i need to redirect it to “HTTPS” so i found around that you need to find the we.config file and edit it, i think i found the file but is called .htaccess and it has this on the inside:

    # 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

    and i found online that you need to add this code to redirect http to https:

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    i am not really a developer, i know some c, arduino code, and just started to learn xhtml, so i wanted to make sure i dont screw up my .config file, so how can i add the suggested code to my existing .config file to succesfully redirect my website to “https”? also, when i manually type in my website address but using https i can see the ssl certificate on the address bar but it says the connection is not secure because it contains insecure elements, im guessing because all of the content and images has been uploaded using http, do i need to manually change all of my images, icons, etc using https to be able to change that status to secure? in advance, thank you!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Moderator James Huff

    (@macmanx)

    Did you change the two URL values at Settings -> General to be HTTPS?

    do i need to manually change all of my images, icons, etc using https to be able to change that status to secure?

    Yes, if your site is over HTTPS, all elements loaded on it will need to be HTTPS too in order to avoid that error.

    This plugin will help you to find and replace such links: https://www.ads-software.com/plugins/better-search-replace/

    Thread Starter wolfnuka

    (@wolfnuka)

    ok i replaced the URL values to use HTTPS at the general settings, and somehow all the pictures, icons, etc, changed itself to https, although i couldn’t get the 301 redirects to work by modifying the .htaccess file, i got the website to run using HTTPS, so now it shows the padlock and ssl certificate, when i modified the .htaccess file as suggested i couldn’t access the website, google said that “it had too many redirect loops” so i just left the .htaccess with the default code on it, and what i did was to go to the wordpress panel and modified the WordPress Address (URL) and Site Address (URL) are using https, after that i added my website to the google webmaster tools, and i think that closed the circle, but when i type my website without “www” or “https” it still directs me to the HTTP version, not the HTTPS version, annoying really….

    Moderator James Huff

    (@macmanx)

    If you set the two URLs at Settings -> General to HTTPS, WordPress should always be redirecting you to HTTPS.

    Did you set anything in your hosting provider’s control panel to force HTTP instead?

    Thread Starter wolfnuka

    (@wolfnuka)

    yep, they’re both set to HTTPS, and i can’t find anything on the server end that might be forcing to use HTTP :-/ , and like i said, i tried changing the .htaccess file to force the site to use HTTPS, but that didn’t work, it sends google to do infinite loops, so i left it with the default code which i posted on my first post on this thread

    Moderator James Huff

    (@macmanx)

    Ok, so you tried it without this code:

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    and it didn’t work?

    So, you added that back in?

    What is the URL of the affected site?

    Thread Starter wolfnuka

    (@wolfnuka)

    No no, the default .htaccess file on my server has the following code:

    # 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

    and then i did modify it with this:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    </IfModule>

    and it does work, but only for the main page “home” all the other pages dont get redirected to HTTPS using code, so since that didn’t work to redirect THE WHOLE DOMAIN to HTTPS, i left it as it was, and only changed the 2 URL’s from the WordPress control panel, and then added my site to Google webmaster tools panel, and after that, my website displays the SSL and PADLOCK certificate, but when you open any browser, and just type my domains name without “wwww” like this : “silverwolfpcrepair.com” it directs you to the HTTP version and NOT the HTTPS, but once inside the website if you click on any page and even the “home” tab, it does direct you to the HTTPS version, so i am really confused

    Moderator James Huff

    (@macmanx)

    Both actually go to regular HTTP for me.

    Any improvement if you try this plugin? https://www.ads-software.com/plugins/wordpress-https/

    Thread Starter wolfnuka

    (@wolfnuka)

    i read reviews on the plugin and for a lot of people it seems to screw the whole website up, i’m very hesitant to use any plugin to do this really

    Moderator James Huff

    (@macmanx)

    The plugin is kind of a last effort if other methods aren’t working.

    If the plugin fails for you, you can safely remove it.

    Thread Starter wolfnuka

    (@wolfnuka)

    ok so i created a thread at stack overflow, and someone suggested this code

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

    so far it works like a charm, even when you manually type the HTTP address of my website, it redirects you to the HTTPS version, and all the other pages of my site work with it!

    Moderator James Huff

    (@macmanx)

    Outstanding, thanks for sharing your solution!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘HTTPS Redirect’ is closed to new replies.