Apache httpd redirect all requests to https

 

To redirect all http request to https add following rule in apache2.conf or httpd.conf or .htaccess file.

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://www.example.com/secure

I am added above rule in .htaccess file which is secure directory. This rule will redirect all request coming to /secure directory to https authontication.

After adding restart apache2/httpd and test.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s