0

I'm about to change the domain name on a very huge website.

I'm trying to figuring a way to don't loose SEO and I was thinking if I can create one script to do a multi-redirection link.

Let's say now the domain name is www.domain1.com and I want to switch to www.domain2.com. Once I've set up the dns of domain2.com to point to the website and so it becomes the default domain, I was thinking to keep domain1.com and redirect every request to it at domain2.com EG: if someone write: www.domain1.com/contacts I want to have an automatic redirect to www.domain2.com/contacts. Now the only way I know to do it is recreating all folders structure and place a php script (header(url)) in each of them but since the website is really big I was wondering if any of you knows a way to create just one file, placed under ww.domain1.com as an index.php, and put inside some script that gets the url that has been requested, cut the part after the first / and put it into a variable that I can use in the "header" command without recreate all structure.

Is that something possible? Cheers

Valina
  • 1,739
  • 2
  • 11
  • 9
  • Have a look at the RewriteEngine, e.g. see http://stackoverflow.com/questions/17365397/redirect-multiple-domains-to-one-domain-with-or-without-www-before – matthias Feb 12 '15 at 15:45
  • Thanks Matthias, I'll look inot it but it seems to be exactly what I was looking for. Cheers Man! – Valina Feb 12 '15 at 16:30
  • The method posted in the link above seems to redirect any url like: www.olddomain.com/contact or www.olddomain.com/aboutus to the home of the new domain and not to www.newdomain.com/contact or www.newdomain.com/aboutus. – Valina Feb 13 '15 at 14:15

0 Answers0