Monday, November 28, 2011

How to redirect http to https using .htaccess on SuSE

1. install apache2-worker module
#yast -i apache2-worker
2. load apache mod_rewrite module
by add the following line to /etc/apache2/httpd.conf
LoadModule rewrite_module /usr/lib/apache2/mod_rewrite.so
3. edit your .htaccess with correct IP address and directory
kcuf:/srv/www/htdocs/dara # cat .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} dara
RewriteRule ^(.*)$ https://192.168.4.2/dara/$1 [R,L]

NOTE:
Make sure that you have configure that directory or address use with https already.

- My IP address 192.168.4.2
- My directory is dara

---------------------------------------------------------------------------------------------------------------------------------------

No comments:

Post a Comment