How to redirect all http request into https using htaccess?

To redirect http url or request into https version you need to add certain rules into .htaccess file. To do this you need to create .htaccess file or edit if you already have it. Add the following rule in .htaccess file:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://yourdomain.com/$1 [R,L]

The third line does the main work. It redirects all request into https version. Just change yourdomain.com into your suitable one. Thats all.

About the Author

has written 38 stories on this site.

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

*

Copyright © 2024 Programmer to Programmer- A website for web programming and mobile application programming tutorials.
Wordpress themes