Force redirect http to https using htaccess

Redirect http url to https

Force redirect http traffic to https

Redirect http to https url using simple file. If you have recently switched to https version, which is recommended, then you want to force the traffic to https.

This can be accomplished using .htaccess file.

How to redirect https to http

1. Create/update the .htaccess file on your root website.
2. Add the following line on the top part of the .htaccess file


RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

3. That is it. You don’t need to restart the server for this case.

You can refer this page for more htaccess examples

Redirect in Javascript

Apache listing directory – I swear I have index file!

Installing Imagick on mac for php 54

Apache not executing PHP code – just renders the as it is

How to access phpmyadmin on ubuntu

Apache Access log is empty – how to change access log in apache php

Leave a Reply

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

*
*