subdomains & www

Discussion in 'Apache' started by Bartbos, Aug 5, 2005.

  1. #1
    I have set up a bunch of rewrite rules for subdomains. This works perfectly, but unfortunately some people try to access their site by WWW.subdomain.example.com (when they should be using just subdomain.example.com)

    What do I need to change to allow www added to the front as well? Here's an extract from my httpd.conf:


    RewriteEngine on
    Options -ExecCGI -Includes
    RewriteCond %{HTTP_HOST} ^[^.]+\.example\.com$
    RewriteCond %{HTTP_HOST} !^www\.example\.com$
    RewriteCond %{HTTP_HOST} !^host\.example\.com$
    RewriteRule ^(.+) %{HTTP_HOST}$1 [C]

    RewriteRule ^([^.]+)\.example\.com/?$ /home/wa/public_html/front/index.php?subdomain=$1&module=welcome&view=index [L]
    RewriteRule ^([^.]+)\.example\.com/aboutus.html$ /home/wa/public_html/front/index.php?subdomain=$1&module=general&from=aboutus&view=index [L]
    RewriteRule ^([^.]+)\.example\.com/events.html$ /home/wa/public_html/front/index.php?subdomain=$1&module=events&view=index [L]
    ...

    Thanks
     
    Bartbos, Aug 5, 2005 IP