Re: [users@httpd] mod_rewrite

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

 



On 8/28/06, David J. Wells <dwells@xxxxxxxxxxxxxxxxxx> wrote:


Hello,

I am attempting to redirect traffic for 1 vhost only to https and allow http
to another… I'm trying to do this with mod_rewrite and having no success.
Any suggestions?  See code below:

# This one we want http access to
<VirtualHost otherdomain.com>
   ServerName www.otherdomain.com
   DocumentRoot /var/www/html
</VirtualHost>


# this one we want https to
<VirtualHost servername:80>
    ServerName www.servername.com
    DocumentRoot /var/www/html
    <Directory /var/www/html>
        AllowOverride All
        RewriteEngine On
        RewriteCond %{SERVER_PORT} !^443$
        RewriteRule (.*) https://%{SERVER_NAME}$1 [L,R]
    </Directory>
</VirtualHost>

#SSL.conf
<VirtualHost _default_:443>
DocumentRoot "/var/www/html"
ServerName www.servername.com:443
[ssl stuff]
</VirtualHost>

First, your non-ssl virtual hosts are using name-based
virtual-hosting, but you aren't doing it correctly.  You need to
follow the example at:
http://httpd.apache.org/docs/2.2/vhosts/name-based.html#using

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[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