Using Mod Rewrite Rules To Move Folders To A New Domain
Writing by Nick Stamoulis on Thursday, May 7, 2009 Leave a comment
If you have a set of folders that you want to spin off into a separate domain name, that is possible using mod rewrite rules. Let me be clear that the following instructions are for Apache servers. The protocol will be different for Linux and Windows servers. But let’s say you have a blog that you want to spin off into its own domain name.
For instance, your blog currently sits at http://mydomainname.com/blog, but you want to move it to http://myblog.com. How do you move your blog to the new domain name without breaking your links?
Create an .htaccess file out of a blank Notepad document and add this one line of code to it:
RedirectMatch 301 blog/(.*) http://myblog.com/$1
Broken down, the command involves your existing folder at the old domain followed by a forward slash and .* enclosed in parentheses. The asterisk in parentheses tells the user’s browser to include any folder with the preceding antecedent in the command. So any permalink in the blog folder of your domain name will be redirected. Put the .htaccess file in the folder in question (ie blog) and your redirect will be complete.
It’s always best, when you are redirecting a series of pages, to just include the paramaters for the parent page or folder and include all its subservient pages. It’s a lot less work.
Leave a comment Category: Webmaster Tools
Read similar posts in Webmaster Tools
- Is Page Load Time Going To Be More Important?
- Matt Cutt’s View on Changing Your Hosting
- New Region Tags For .com, .net TLDs
- The Best Free Backlink Tool On The Planet
- Total Or Unique Visitors, What Is the Difference?
Subscribe to our RSS feed
No comments yet.
Subscribe to our RSS Feed



