0 Replies - 893 Views - Last Post: 08 November 2011 - 10:19 PM

#1 wintermute  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 26
  • Joined: 27-April 09

virtual hosts / multiple subdomains not working

Posted 08 November 2011 - 10:19 PM

I'm getting a 302 on http://test.example.com, but my index.php is never accessed.

Here is my virtual hosts config:

<VirtualHost *:80>
        ServerName example.com
        ServerAlias *.example.com

        Options +FollowSymLinks
        RewriteEngine On

        DocumentRoot /my/root/directory
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        <Directory /my/root/directory>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

And here is how my .htaccess file looks:
   Options +FollowSymLinks
   Options +Indexes
   RewriteEngine On
   RewriteBase /
   RewriteCond %{HTTP_HOST} !example.com$ [NC]
   RewriteRule ^(.*)$ http://example.com [L]

You'll notice that I'm rewriting EVERYTHING to http://example.com. This is just a basic test, but all I get when I go to http://test.example.com is this:
HTTP/1.1 302 Found
Date: Wed, 09 Nov 2011 05:10:32 GMT
Server: Apache/2.2.3 (Red Hat)
Location: http://search5.comcast.com/?cat=dnsr&con=ds&url=test.example.com
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

http://example.com is my localhost

I'm running Apache/2.2.17 (Ubuntu)

It works when I add the specific subdomain to my /etc/hosts file, but this defeats the purpose for wildcard subdomains, at least for me. Is there a way to get this to work?


Is This A Good Question/Topic? 0
  • +

Page 1 of 1