Re: rewrite to https website

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxx
        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@xxxxxxxxxxxxxx> wrote:
On Tue, Apr 24, 2012 at 12:24 PM, TianJing <jingtian.seu217@xxxxxxxxx> 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@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




--
Tianjing



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux