Re: Subdomain rewrite

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

 




On Mar 21, 2012, at 8:09 PM, Chris Arnold wrote:

Apache 2.2.12 on SLES11 SP2. I am trying to get a subdomain working via a rewrite rule, http://helpdesk.teknerds.net.
The rule is in its own vhost (helpdesk.teknerds.conf. I am confused if it needs its own vhost or if the rewrite should go in teknerds.conf vhost) and follows:
<VirtualHost *:80>
   ServerAdmin administrator@xxxxxxxxxxxx
   ServerName teknerds.net
   ServerAlias *.teknerds.net

   RewriteEngine On
   RewriteCond %{HTTP_HOST} !^(www|m|secure|admin).* [NC]
   RewriteCond %{HTTP_HOST} ^([^\.]+)\.teknerds\.net
   RewriteCond /opt/otrs/bin/cgi-bin/%1 -d
   RewriteRule ^(.*) /%1/$1 [L]

   DocumentRoot /opt/otrs/bin/cgi-bin/

<Directory "/opt/otrs/bin/cgi-bin/">    
#
# Controls who can get stuff from this server.
#
AllowOverride FileInfo AuthConfig Limit Indexes
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all

   </Directory>

The behavior that is happening is a listing of the site and it takes over all sites. So when you goto http://helpdesk.teknerds.net/, it lists the files in the doc root. If you goto http://teknerds.net it is the same listing as above. I expect helpdesk.teknerds.net to be its own site and all other sites to be there own.

Forgive me for asking an obvious question, but have you considered just having separate virtualhost blocks for each virtualhost? If you put a virtualhost for helpdesk.teknerds.net before this vhost, then it will catch that hostname before the wildcard serveralias is considered.




[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