
Apr 10
Redirect Old Domain Names with Apache htaccess File
Redirect an identical site to a new domain
If the website is the same, just under another domain, you will want to redirect everything (by using a /). In the example below the URL “http://www.oldsite.com/about.php” would redirect to “http://www.newsite.com/about.php”:
1 | Redirect 301 / http://www.newsite.com/ |
Redirect pages to a new website
If you have created a completely new website on another domain (that has different URLs and file names) you will most likely have to manually redirect certain pages. In that case you would use:
1 | Redirect 301 /theoldpage.html http://www.newsite.com/newpage.php |
Redirect everything to a new domain (specific page)
If you have a completely new website that has different filename and page locations you might want to redirect everything on your old domain to an absolute URL. To do this you use the asterisk (*) instead of the root forward slash (/).
1 | Redirect 301 * http://www.newsite.com/ |
For more complex rewrites you will most likely need to look into using mod_rewrite (the rewrite module for Apache servers). You can also rewrite URLs with PHP (although I don’t recommend it).
Bookmark or share this page:
Related posts:
- Mapping Linux (ext3) File System for use in Apache under Windows
- URI Rewriting Alongside WordPress’ PermaLinks
- PHP URL Rewriting Without Apache and mod_rewrite
MSN Contact: contact [at] danielgibbs.net
Dan Gibbs is a web developer, designer and SEO consultant involved in devon web design.





