How to redirect http to https (SSL) using .htaccess and mod_rewrite with Apache web server
If you want to use https (SSL) for the entire web site, edit .htaccess and add the following lines:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.my-site.com/$1 [R,L]
if you want to enforece https (SSL) for a paticular directory (and sub-directories), create an .htaccess file with the following lines:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} my_directory
RewriteRule ^(.*)$ https://www.my-site.com/my_directory/$1 [R,L]
Make sure you turn on RewriteEngine in your httpd.conf file:
RewriteEngine on
Then restart apache
apachectl restart
Popularity: 1%


















































