Is this done at the server level or in vhosts? How many vhosts? I askOn 3/17/2012 12:58 PM, aparna Puram wrote:
> Hello All,
>
> I am working on a project where I have to redirect all the http
> requests to https protocol. I have configured the following rewrite
> rules and it is working fine.
>
> RewriteEngine On
> RewriteCond %{SERVER_PORT} !^443$
> RewriteRule ^(.*)$ https://<dns name>$1 [L,R]
>
>
> then http://<dns name> is redirecting to https://<dns name>
> & http://<localhost name> is redirecting to htps://<dns name>
>
> However, https://<localhost name> is not being redirected to
> https://<dnsname>, It is just being https://localhost
>
> Since I have a ssl installed with the common name (CN) as the dns name.
>
> I need the https://local host name to be redirected to https://dns name.
>
> Kindly suggest me what needs to be done.
>
> Thanks in advance.
>
>
because I typically use a configuration like this:
<VirtualHost *:80>
RedirectPermanent / https://somewhere.com/
</VirtualHost>
However, I typically only have one :80 vhost and one :443 vhost.
If that can't work, I can't speak to why your rule isn't working... but
you should definitely anchor with slashes like so:
RewriteEngine OnRewriteRule ^/(.*)$ https://<dns name>/$1 [L,R]
RewriteCond %{SERVER_PORT} !^443$
You can also try enabling the rewrite log for more details.
--
Daniel Ruggeri
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx