Redirecttions after SSL certificate installation

Hagai Shaul

Member
Apr 2, 2014
5
0
1
cPanel Access Level
Root Administrator
HELLO

I installed ssl cert to my website (example domain name - http://8websitename8.com without www) and I want to know how to make the redirection in the htaccess file inside the root directory so any other link will point to https://8websitename8.com (with https).

I succeeded to do the following (For other members who will see this post :)
RewriteCond %{HTTP_HOST} ^www.8websitename8.com$ [OR]
RewriteCond %{HTTP_HOST} http://www.8websitename8.com$ [OR]
RewriteCond %{HTTP_HOST} http://8websitename8.com$
RewriteRule ^(.*)$ https://8websitename8.com/$1 [R=301]


I also want to redirect https://www.8websitename8.com/ (with https and www) to https://8websitename8.com/
(with https and without www) because now it gives ssl error about the authentication of this certificate.

I tried to do the following but it did not work

RewriteCond %{HTTP_HOST} https://www.8websitename8.com$
RewriteRule ^(.*)$ https://8websitename8.com/$1 [R=301]


and also

RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} https://www.8websitename8.com$
RewriteRule ^(.*)$ https://8websitename8.com/$1 [R=301]


I do all of this so the website will not have duplicate content - for seo.

I will appreciate any help.

Many thanks
Hagai Shaul
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Hello :)

You could try an entry in the .htaccess file like this:

Code:
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://domain.com/$1 [R,L]
Thank you.
 

Hagai Shaul

Member
Apr 2, 2014
5
0
1
cPanel Access Level
Root Administrator
Hi Michael
Thanks very much.
Yorks great :)

- - - Updated - - -

Hi
I had a mistake. I think it happend because of a cache in the browser.
I tried to do it and I received the same error.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,904
2,218
463
Do you have any other redirects or .htaccess rules configured in the public_html directory or any other subdirectory?

Thank you.