Post by rmichel » Sat Apr 24, 2021 1:11 pm

Hello everyone. Can someone tell me how to forward from http to https. I already have bought the ssl and have gone into my admin panel and clicked on the USE SSL, I just needed to know if I need to add any coding to my .htaccess that I already have which I have attached how my .htaccess looks from the inside pdf so anyone that can help can see it, Can anyone help please?
Last edited by rmichel on Sun Apr 25, 2021 10:44 pm, edited 1 time in total.

New member

Posts

Joined
Wed Jul 26, 2017 2:24 am

Post by ADD Creative » Sat Apr 24, 2021 8:05 pm

After RewriteEngine On you would need something like.

Code: Select all

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Then your will need something to redirect www to non-www or vice versa. But that will depend it if you a using www. or not. Search these forums, there are lots of examples.

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by rmichel » Sun Apr 25, 2021 12:06 am

I have search for Forums, but can't find anything like my situacion, and all I need if the Code like the above person as given me, and HOW to forward from http to https, CAN ANYONE HELP ???

New member

Posts

Joined
Wed Jul 26, 2017 2:24 am

Post by ADD Creative » Sun Apr 25, 2021 1:16 am

The above post is how you redirect http to https. Do all your URLs in config.php and admin/config.php start with https?

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by rmichel » Sun Apr 25, 2021 3:01 am

ADD Creative wrote:
Sun Apr 25, 2021 1:16 am
The above post is how you redirect http to https. Do all your URLs in config.php and admin/config.php start with https?
Yes, all my config.php start with https:// . If you are saying the post from the other person is the way to direct to https, but he is mentioning that after adding the Code, I need something else to redirect, and he is not mentioning how, Do you or anyone know what else I need?

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

New member

Posts

Joined
Wed Jul 26, 2017 2:24 am

Post by ADD Creative » Sun Apr 25, 2021 3:10 am

You don't need anything else to redirect http to https.

But you will need to redirect to your correct domain with or without www. But you don't give much information so it's hard to say exactly what you need.

An example if your domain was www.example.com.

Code: Select all

RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ https://www.example.com/$1 [E=HTTPS,R=301,L]

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by rmichel » Sun Apr 25, 2021 4:37 am

ADD Creative wrote:
Sun Apr 25, 2021 3:10 am
You don't need anything else to redirect http to https.

But you will need to redirect to your correct domain with or without www. But you don't give much information so it's hard to say exactly what you need.

An example if your domain was www.example.com.

Code: Select all

RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ https://www.example.com/$1 [E=HTTPS,R=301,L]
Ok, in regards to your comment above, I have put a Print Screen of the .htaccess file with the CODE that you have given me in line 42 and 43 of the Print Screen that I have attached. Can you tell me if this is correct and if there is anything else I need to do?

New member

Posts

Joined
Wed Jul 26, 2017 2:24 am

Post by ADD Creative » Sun Apr 25, 2021 5:43 am

You should have both bits of code. And of course change www.example.com to your domain.

Code: Select all

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ https://www.example.com/$1 [E=HTTPS,R=301,L]

www.add-creative.co.uk


Active Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by rmichel » Sun Apr 25, 2021 8:46 am

ADD Creative wrote:
Sun Apr 25, 2021 5:43 am
You should have both bits of code. And of course change www.example.com to your domain.

Code: Select all

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ https://www.example.com/$1 [E=HTTPS,R=301,L]

Awesome, that seems to worked, thank you, Just one last question, I have put the Code that you have given me right below #41 RewriteEngine On as the Example that I have attached below, and Can you tell me if that is the right spot where I have put Code or does it need to be somewhere else?

New member

Posts

Joined
Wed Jul 26, 2017 2:24 am

Post by khnaz35 » Sun Apr 25, 2021 4:18 pm

rmichel wrote:
Sun Apr 25, 2021 8:46 am
Awesome, that seems to worked, thank you, Just one last question, I have put the Code that you have given me right below #41 RewriteEngine On as the Example that I have attached below, and Can you tell me if that is the right spot where I have put Code or does it need to be somewhere else?
As ADD Creative mentioned code worked for you it doesn't matter in .htaccess where you put it.
What matter is the code works for you.

If you problem has solved don't forget to add word [SOLVED] in the beginning of your post title.

Urgent Questions shoot here: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member
Online

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by rmichel » Sun Apr 25, 2021 10:43 pm

khnaz35 wrote:
Sun Apr 25, 2021 4:18 pm
rmichel wrote:
Sun Apr 25, 2021 8:46 am
Awesome, that seems to worked, thank you, Just one last question, I have put the Code that you have given me right below #41 RewriteEngine On as the Example that I have attached below, and Can you tell me if that is the right spot where I have put Code or does it need to be somewhere else?
As ADD Creative mentioned code worked for you it doesn't matter in .htaccess where you put it.
What matter is the code works for you.

If you problem has solved don't forget to add word [SOLVED] in the beginning of your post title.
Thanks for your answer, Yes, I will add the word [SOLVED] in the title, thank you.

New member

Posts

Joined
Wed Jul 26, 2017 2:24 am
Who is online

Users browsing this forum: No registered users and 6 guests