httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From TianJing <jingtian.seu...@gmail.com>
Subject Re: [users@httpd] rewrite to https website
Date Tue, 24 Apr 2012 11:43:11 GMT
sorry, more detail info:

ssl:
NameVirtualHost *:443
<VirtualHost *:443>
       DocumentRoot /usr/local/webapps
       ServerName www.a.com
       ErrorLog /var/log/httpd/error_log
       TransferLog /var/log/httpd/access_log
       SSLEngine on
       SSLCertificateFile /etc/pki/tls/certs/a.com.crt
       SSLCertificateKeyFile /etc/pki/tls/private/a.key
</VirtualHost>

<VirtualHost *:80>
        ServerAdmin xxx@a.com
        DocumentRoot /usr/local/webapps/
        ServerName www.a.com
        RewriteEngine on
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{SERVER_NAME}:443%{REQUEST_URI}
</VirtualHost>

 <VirtualHost *:80>
        ServerName www.b.com
        RewriteEngine on
        RewriteOptions Inherit
        RewriteRule ^/(.*) http://www.a.com/$1 [R,L]
        ErrorLog logserror_log
        CustomLog logs/access_log common
</VirtualHost>

i want that when i using www.b.com,then it will redirect to
https://www.a.com.

thanks,




On Tue, Apr 24, 2012 at 7:31 PM, Tom Evans <tevans.uk@googlemail.com> wrote:

> On Tue, Apr 24, 2012 at 12:24 PM, TianJing <jingtian.seu217@gmail.com>
> wrote:
> > Hi all,
> >
> > I have a question on apache rewrite, I have a https website:
> https://www.a.com
> >
> > I want add another url(http://www.b.com),and this url will be forward
> > to https://www.b.com
> >
> > I using the rewite rules, but I seem doesn't work.
> >
> > any suggestions?
> >
>
> You need to give more information. You haven't said anything useful.
>
> What did you try? Show your config
> What happened?
>
> In a general sense, what you are trying to do is easy. You've gone
> from one SSL vhost to two SSL vhosts and a non SSL vhost that
> redirects to one of the SSL vhosts:
>
> <VirtualHost 12.34.56.78:443>
>  ServerName a.com
>  # a.com's SSL settings, etc
> </VirtualHost>
>
> <VirtualHost 12.34.56.79:443>
>  ServerName b.com
>  # b.com's SSL settings, etc
> </VirtualHost>
>
> <VirtualHost *:80>
>  ServerName b.com
>  Redirect / https://b.com/
> </VirtualHost>
>
> Cheers
>
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>


-- 
Tianjing

Mime
View raw message