Domain migration - 301 Redirect of all contentes of directory)

Posted by Trufa on Server Fault See other posts from Server Fault or by Trufa
Published on 2011-01-10T19:00:53Z Indexed on 2011/01/12 14:55 UTC
Read the original article Hit count: 209

Hi,

I would like to know if it is possible to do the following considering that I would like to migrate domains.

I have lets say:

one.com/files/one.html

one.com/files/two.php

one.com/other/three.html

one.com/other/four.doc

one.com/other/subdirectory/five.doc

I am migrating to two.com

So I would like to make RESPECTIVE 301 redirects to the following:

two.com/old/files/one.html

two.com/old/files/two.php

two.com/old/other/three.html

two.com/old/other/four.doc

two.com/old/other/subdirectory/five.doc

I've tried with cPanel and although I come "close" with the redirects option I can't seem to make it happen.

The folders are not much (10 -12) the file are a lot, and obviously impossible to make it manually.

How would you proceed? Can this/ should this be done with regex from the .htaccess??

Can you direct all the elements of a subdirectory in the manner expressed above?

I hope the question is clear enough, if not please ask for any clarification needed!!

Thanks in advance!!

© Server Fault or respective owner

Related posts about .htaccess

Related posts about redirect