[internetworkers] Apache httpd.conf help

Greg Cox glcox at pobox.com
Wed Feb 18 11:29:33 EST 2004


> I want mydomain.org to be the primary domain.  If anyone visits the site by
> typing mydomain.com or mydomain.net I want Apache to force a HTTP 301
> redirect to mydomain.org.  

<VirtualHost *:80>
  ServerAdmin me at mydomain.org
  DocumentRoot /var/www/tld/mydomain
  ServerName  www.mydomain.org
  TransferLog logs/tld/mydomain_access_log
  ErrorLog logs/tld/mydomain_error_log
</VirtualHost>

<VirtualHost *:80>
  ServerName mydomain.org
  ServerAlias mydomain.net www.mydomain.net mydomain.com www.mydomain.com
  TransferLog logs/tld/mydomain_access_log
  ErrorLog logs/tld/mydomain_error_log
  RewriteEngine on
  RewriteRule ^/$ http://www.mydomain.org [R=301,L]
  RewriteRule ^/(.*) http://www.mydomain.org/$1 [R,L]
  <IfModule mod_userdir.c>
    UserDir disabled
  </IfModule>
</VirtualHost>





More information about the InterNetWorkers mailing list