Looking for setting that prevents www and non www

Discussion in 'Installation/Configuration' started by wxman, Jun 28, 2010.

  1. wxman

    wxman New Member

    I was just fighting with trying to get my sites to work with both www and non www. I edited the htaccess files, made sure I have both A records, and ISPConfig "Auto-Subdomain" was set to '*'. I even added:
    Code:
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^domain\.com
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
    
    to the Apache directives options box. It still wouldn't work.

    I went into my apache files and looked up one of the domain
    'etc/apache/sites-available/www.domain.com.vhost' files and found it like this:

    Code:
    <Directory /var/www/www.domain.com>
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    <VirtualHost *:80>
          DocumentRoot /var/www/www.domain.com/web
      
        ServerName www.domain.com
        ServerAlias *.www.domain.com
        ServerAdmin webmaster@domain.com
    
    ....
    
    Once I edited "ServerAlias *.www.domain.com" so it reads "ServerAlias *.domain.com domain.com" then it works.
    My question is, what setting in ISPConfig is automatically making it look like "ServerAlias *.www.domain.com" when you select "Auto-Subdomain" set to '*'?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    You have setup the website in the wrong way. In the domain field, you have to enter domain.com and not www.domain.com and then select auto subdomain www and not auto subdomain *.
     
  3. wxman

    wxman New Member

    Ok that looks better when I tried that. What happens if I ever want to add another sub domain? Do I have to set the subdomain back to '*'?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    No. Then you add a subdomain. The setting * is only used for cms systems that require wildcard setting like the multiuser version of wordpress (wordpress MU)
     
  5. wxman

    wxman New Member

    A lot of my sites are Drupal installs. If I decide to go multi site install, then I'd use that?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. If these sites are all subdomains of the same domain. If not, you add aliasdomains and dont use the wildcard. The problem with wildcards is that if you have a website with wildcard enabled and then you decide to add another website with a subdomain of the same domain, then this econd website will not work as all traffic is routed to the first website. Additionally, wildcards are bad for your google rank as you get a lot of duplicate content from googles point of view, as countless subdomains point to the same vhost.
     

Share This Page