Help - Search - Members - Calendar
Full Version: Redirecting Domains With Apache - Help!
Linuxhelp > Support > Technical Support
markjw27
I hope someone can help me with this little problem:

I have a linux server running apache. My main website is running as www.mydomain.com. I need to setup the server so that my other registered domains, eg. www.mydomain.net, www.mydomain.org, etc., will redirect to www.mydomain.com regardless of the page opened within the domain.

I am running DNS and have created SOA's for all the extra domains. Each one has only the following added:

CNAME - alias host: www target: mydomain.com

And nothing else - eg. No A, MX, etc.

When I go to one of the extra domains, I just get the server's 404 error page.

Someone in support told me I need to update the httpd.conf file - I have had a look, but this is really stretching my linux skills. Can anyone please tell me exactly what I need to add/edit on the httpd.conf file to update the HTTP headers for the above. Below is the entry for the main domain - there are no other entries for the extra domains:

<VirtualHost 12.34.56.78:80>
ServerName www.mydomain.com
ServerAdmin mydomain@www.mydomain.com
ServerAlias mydomain.com
DocumentRoot /home/domain/domain2/web
ErrorLog "|/usr/ins/intel/bin/webspy /home/domain/domain2/logs/error_log"
TransferLog "|/usr/ins/intel/bin/webspy /home/domain/domain2/logs/access_log"
RewriteEngine on
RewriteCond %{HTTP_HOST} !^12.34.56.78(:80)?$
RewriteCond %{HTTP_HOST} !^www.mydomain.com(:80)?$
RewriteRule ^/(.*) http://www.mydomain.com/$1 [L,R]
RewriteOptions inherit
AliasMatch ^/~([^/]+)(/(.*))? /home/domain/domain2/users/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /home/domain/domain2/users/$1/web/$3
AddHandler server-parsed .shtml
AddType text/html .shtml
<Location />
Options +Includes
</Location>
</VirtualHost>


Many thanks,
Mark
Joey
Just shove the other domains under serveralias and restart apache.

ServerAlias mydomain.com www.mydomain.net mydomain.net www.mydomain.org mydomain.org

I have the same setup with linuxhelp.ca and linuxhelp.net

ServerName www.linuxhelp.ca
ServerAlias linuxhelp.ca www.linuxhelp.net linuxhelp.net
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.