cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Go to solution

HTTP to HTTPS redirect not working

HI

i have installed ssl, and then i tried to redirect http to https. i write the following code to .htaccess file


RewriteEngine on
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{HTTP_HOST} ^(www\.)?j3s\.com\.au
RewriteRule ^(.*)$ https://www.j3s.com.au/$1 [R,L]

 

can you please help me to fix the issue.  http to https redirection doesnot work

3 REPLIES 3
Super User III
Super User III
Solution

Re: HTTP to HTTPS redirect not working

Hey there @smsafkat 

 

If you're on cPanel Linux Hosting, give this a shot:

 

  1. Set the base url for both secure and unsecure in the backend (System > Configuration > General > Web). Set yes in "use secure url in frontend".
  2. Add the following to your .htaccess file or Apache server configuration:

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


I am a GoDaddy End User - Just Like You
* Please note that I offer free advice on this forum. I DO NOT answer private messages. Please ask your question in the proper forum so the answer can assist EVERYONE in the community and not just you. Thanks! *

Once your issue is resolved,
please be sure to come back and click accept for the solution

Get Better Support on the Community Boards!
Etiquette When Asking for Help from the Community


Re: HTTP to HTTPS redirect not working

I am using the Plesk admin and I have tried editing the .htaccess file and adding a web.config file based on some responses here.  Of course, I tried each separately.  Neither seems to redirect the http  to https.  Should I be doing something different in Plesk.  I did not try your suggestion because I am not using Cpanel.  Any help appreciated.

 

 

Re: HTTP to HTTPS redirect not working

RewriteEngine On
# This will enable the Rewrite capabilities
RewriteCond %{HTTPS} !=on
# This checks to make sure the connection is not already HTTPS
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
# This rule will redirect users from their original location, to the same location but using HTTPS.
# i.e. http://www.example.com/foo/ to https://www.example.com/foo/
# The leading slash is made optional so that this will work either in httpd.conf
# or .htaccess context
#END