Redirect http:// to https://
August 17th, 2007
I have been looking online for some time to redirect http:// URL to https:// automatically. So when a user requests vax.org, it will be redirected to https://vax.org.
After several searches, this is what i have found :
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
- Open your preferred editor
- Copy-paste text and save as . htaccess
- Upload the file to your root directory (where your main index file is located)
- Lastly, CHMOD the file to 775 or 777
You have got yourself a redirection.