0

I have a website which has 2 parts - lets say A and B.

Now I want to move part A to a new domain.

Currently, the URLs are of the form:

www.xyz.com/A/controller/function - for part A

www.xyz.com/A/B/controller/function - for part B

my new links will be:

www.abc.com/controller/function - for part A

www.xyz.com/B/controller/function - for part B

Can you suggest me a good way to handle these redirects? I am using Codeigniter Framework.

Amit Singh
  • 55
  • 8

2 Answers2

0

Are you using the same CI install for both parts? If so then this link may help you.

If each part has its own CI install, don't forget you can use the same system folder for both by setting the $system variable in the index.php file

Rooneyl
  • 7,802
  • 6
  • 52
  • 81
0

Try adding the following to the .htaccess file in the root directory of your www.xyz.com site.

RewriteEngine on
RewriteBase / 

#redirect www.xyz.com/A/B/controller/function
#www.xyz.com/B/controller/function
RewriteCond %{HTTP_HOST} ^www\.xyz\.com$ [NC] 
RewriteRule ^A/(B/[\w]+/[\w]+)$ /$1 [L,NC,R=301]


#redirect www.xyz.com/A/controller/function to
#www.abc.com/controller/function
RewriteCond %{HTTP_HOST} ^www\.xyz\.com$ [NC] 
RewriteRule ^A/([\w]+/[\w]+)$ http://www.abc.com/$1 [L,NC,R=301]
Ulrich Palha
  • 9,411
  • 3
  • 25
  • 31