httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vivek Nambiar <vivek1namb...@gmail.com>
Subject [users@httpd] Rewrite Rule
Date Fri, 02 Mar 2012 14:59:26 GMT
Hi Experts,

I have a quick question regarding rewrite rule.

My aim is to redirect users http URL to https URL.

Like suppose the user enters the URL as follows in the web browser

http://servername:port/myapp then it should redirect itself to
https://servername:SSLport/myapp.

I have added the following rewrite condition and rule in my httpd.conf file

RewriteCond %{SERVER_PORT} PORT
RewriteRule ^/(.*)$ https://%{SERVER_NAME}:SSLPORT/$1 [R,L].

The rewrite rule works only if I use the url as http://servername:port/myapp/
(i have to add a "/" infront of my application)

if I use http://servername:port/myapp then the rewrite is done only for the
port,that is it changes to http://servername:sslport/myapp (http does not
change to https).

Thanks in advance for your help.

Mime
View raw message