I think you're saying you want:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^<localhostname>$
RewriteRule (.*) https://<dnsname>%{REQUEST_URI}

As long as you are checking for https or port 443 in the rewrite condition 
you're not redirecting anywhere on HTTPS
requests. If you want HTTPS to redirect then your condition is blocking that. 
The rules above send ALL requests to
the dnsname using https regardless of the scheme actually requested. That seems 
to be the behaviour you're asking for.

This all assumes you are using this rule in your port 80 and port 433 
virtualhosts.



On 18/03/12 17:45, aparna Puram wrote:
> Hello Spliff,
> 
> Well actually to explain the complete scenario,
> 
> RewriteEngine On
> RewriteCond %{HTTPS} off
> RewriteRule (.*) https://<dnsname>%{REQUEST_URI}
> 
> The above rewirte is set to redirect all the http requests to https request.
> 
> It is working fine when I give the http://<localhostname> it is rewriting to 
> https://<dnsname>
> 
> but when I type https://<loacalhostname> it is redirecting to 
> https://<localhostname>
> 
> I want it to be redirecting to https://<dnsname> as the ssl certificate CN : 
> is the dnsname.
> 
> 
> 
> On Sun, Mar 18, 2012 at 10:00 AM, SpliFF <spl...@warriorhut.org 
> <mailto:spl...@warriorhut.org>> wrote:
> 
>     On 18/03/12 15:02, aparna Puram wrote:
>>     Hello Daniel/Mathijs,
>>
>>     There is only one virtual host.
>>
>>     server name is :selecvcp1.sw.ericsson.se 
>> <http://selecvcp1.sw.ericsson.se>
>>     Dns name for that server is : select.ericsson.se 
>> <http://select.ericsson.se>
>>
>>     both will redirect to the same apache
>>
>>     when I use http:selectvcp1.sw.ericsson.se 
>> <http://selectvcp1.sw.ericsson.se>, I m being redirected to
>>     https://select.ericsson.se.
>>     However, When i type https://selectvcp1.sw.ericsson.se, I m still being 
>> in https://selectvcp1.sw.ericsson.se
>>
>>     I m not sure y. Is there any other way around?
>>
> 
>     If you expect https to redirect then your condition:
> 
>     RewriteCond  %{SERVER_PORT} !^443$
> 
>     ... is preventing that. What is the purpose of that condition if not to 
> prevent https from redirecting?
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to