HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (
-   General (
-   -   Domain and email forwarding to new domain (

wpwood3 19th March 2009 19:11

Domain and email forwarding to new domain
How can I forward all of my web and email traffic from an old domain to a new domain?

For example:

For web traffic:
olddomain.tld/index.html > newdomain.tld/index.html
olddomain.tld/folder1/index.php > newdomain.tld/folder1/index.php

Domain forwarding at the registrar will forward web traffic but it doesn't seem to forward the email. We have external spam filtering for all incoming mail but I don't think that is the problem since the translation to "newdomain" would occur at the registrar prior to reaching the filter.

For email traffic:
joe@olddomain.tld > joe@newdomain.tld
sam@olddomain.tld > sam@newdomain.tld

I don't care if the forwarding is done at the registrar or my server but I do need all web traffic and email to be sent to the new domain.

Any ideas?

till 20th March 2009 09:38

Just use the email forwarding function that is builtinto ispconfig or you add a postfix transport in the transports file manually.

wpwood3 20th March 2009 17:28

What about web traffic?
If I forward the domain at the registrar then the email will never reach my server so ISPConfig will not be able to forward the email.

If I do not forward the domain at the registrar and use ISPConfig to forward the email as you suggest, how can I forward the web traffic?
Each web page on the old domain must forward to the same webpage on the new domain like this:
olddomain.tld/index.html > newdomain.tld/index.html
olddomain.tld/folder1/index.php > newdomain.tld/folder1/index.php

falko 21st March 2009 21:57

You can use mod_Rewrite for it. Take a look here:

wpwood3 27th March 2009 00:01

Is this correct?
Thanks for your help.

Let me make sure I understand exactly what you are saying by describing the steps I think I need to take. Maybe I'm making this too complex.

1) At the registrar, point my newdomain to the nameservers on my server.

2) In ISPConfig ISP Manager go to the ISP Site and change the Domain name of my olddomain to my newdomain. (This is easier than moving all of my content from web1 to web2)

3) In ISPConfig ISP Manager create a new site with the olddomain name.

4) In the web root directory of the site created in step#3 above create a .htaccess file to perform 301 redirects to the newdomain:


Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)$1 [R=301,L]

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]
5) In ISPConfig ISP Manager go to the site created in step#3 above and create all olddomain email accounts and forward then to the corresponding newdomain email accounts. (there are only about 15)

Hopefully this will forward all of my web traffic and emails without hurting my Google search ranking too much. That's the main objective. I have read that doing the 301 at the registrar instead of the host may hurt search rankings.

Is there an easier way?

falko 27th March 2009 15:50

You don't need to create a new web site in ISPConfig. You can add and as Co-Domains to the web site and then add the correct rewrite rules so that is redirected to

wpwood3 27th March 2009 17:16

Thanks falko.

Instead of using .htaccess for the 301 redirect can I use "Apache Directives (Optional):" in ISPConfig?
Maybe put something like this there:

RewriteCond %{HTTP_HOST} !^www\.newdomain\.com$ [NC]
RewriteRule ^(.*)$$1 [R=301,L]
The 301 redirect is critical for SEO and it also makes sure the "www" is present in the URL.

Since will be going away I think I will change the Domain of the site to and create co-domains for and That way I can simply delete the co-domains in a year or so when I no longer need them. I think that will do the same thing as you suggest.

falko 28th March 2009 20:24


Originally Posted by wpwood3 (Post 177983)
Instead of using .htaccess for the 301 redirect can I use "Apache Directives (Optional):" in ISPConfig?

Yes, you can do that.

All times are GMT +2. The time now is 17:32.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.