301 redirect from subdirectory to new domain

Hi guys

Ive hit a problem here and cant seem to find a way out :rolleyes:

I have a site that started life as a subdirectory of a domain.


This little site has grown quite large and has a good SEO and link basis built up over the last couple of years, I decided to split it into a domain in its own right on a seperate server.

So I want to 301 redirect all traffic that went to the original location to the new location, I have over 500 pages on the site so a htaccess file for file would be tedious, but when I try a rewrite, I keep getting the ‘mysite’ subdirectory appended to the mysite address. Like www.mysite.com/mysite/file.php

Can anyone help please :wink:


Apache’s mod_alias (the Redirect family of directives is part of the Apache core) is the ideal tool for you! Simply put this in the .htaccess of the OLD website:

Redirect 301 /mysite http://www.mysite.com

With the 301 status, it will update the SE’s and you’ll not lose your rankings.



Thank you very much, I can believe I didnt get to that simple result after all the possibilities I tried.

It works wonderfully, thanks again :slight_smile:


Yes, Apache is WONDERFUL (and quite powerful)!