Home » .htaccess » Redirect HTTP to HTTPS Using .htaccess

Redirect HTTP to HTTPS Using .htaccess

Nowadays with HTTPS (Hyper Text Transfer Protocol Secure) should be everywhere for the websites and Google has recognized this as a ranking sign to their search engines.

Without SSL certificates all browsers began showing insecure warnings on the websites. When viewing our website without SSL it shows insecure to the visitors. Hence using SSL connection for security convenience. So It is very necessary to redirect from HTTP to HTTPS.

HTTPS, also help for website traffic and there are guidance/directives in the .htaccess file that instruct the server how to respond in certain situations and immediately affects how your website functions.

There are several ways to use this redirection, and Lets here we see the following few options to redirect HTTP to HTTPS.

Add the following code in your .htaccess.

Redirect Based On Apache Server
Redirect Based On Apache Server (Optional)
Redirect Based On Port Number
Redirect Only a Specific Domain
Redirect Only a Specific Folder

Was this article helpful?

Yes No

How can we improve it?


We appreciate your helpul feedback!

Your answer will be used to improve our content. The more feedback you give us, the better our pages can be.

Follow us on social media:

Facebook Pinterest


Creative Designer & Developer specialist by the spirit and a loving blogger by thoughts.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top