0

I have a domain www.example.com that is shutting down, but I need to forward it to www.newwebsite.com/example/ incase there are any SEO benefits to it.

The www.newwebsite.com is hosted on a LAMP stack virtual server so I have full access to everything. The www.example.com website hosting has lapsed and so we need to make the repointing at DNS level.

I think I can see two ways of doing this and would like some guidance please!

Route A - Repoint the a-record of example.com, then setup some kinda of virtual host on the newwebsite.com server. Then repoint within that virtual hosting to www.newwebsite.com/example/

Route B - Repointing with cname and use the .htaccess of the www.newwebsite.com/ to point all traffic coming from that address to www.newwebsite.com/example/.

I know how to repoint, but have no idea of what to setup on the new server, all thoughts/help welcome, thanks.

1 Answer 1

2

Whether you use an A record or a CNAME record, the HTTP requests send from the client to the server will look exactly the same.

This conveniently splits the question into two separate questions.

  • How should the DNS records be configured?
  • How should the webserver be configured?

The DNS question is fairly easy to answer. Use a CNAME if possible, because then there is only one place that needs to be updated, if the IP address should ever change. But you cannot have CNAME records and other records on the same domain name. So on the "naked" domain name where you also have some NS records, you can't use a CNAME, but if it is only the www subdomain that need to work, a CNAME record is preferred.

The next question is how to do a redirect on the webserver. A name based vhost is the clean way to do it. I don't know how you were expecting to do it using just .htaccess and no vhost, though I can't say for sure that it would be impossible.

3
  • Many thanks for your answer, it makes a lot of sense. I will make changes to all of the domains (over 250 of them..!) and work out how to setup the multiple vhosts. It was for the multiple reason I was hoping it was all within .htaccess, but I also cannot find anything on how to do it that way. Just need to learn how to setup the vhosts now. Many thanks for your help.
    – JayUK
    May 28, 2014 at 13:56
  • @JayUK If you have 250 domains and every one of them should redirect to a subdirectory on the same target domain, it may be simpler to create on vhost to cover all 250 domains, and another vhost for the domain they redirect to. That way you could have 2 vhosts instead of 251 of them. Including the original domain name as directory name in the target URL being redirected to is possible. I know for a fact, that it can be done with php. I think it can be done simpler using mod_rewrite, but that I am not sure about.
    – kasperd
    May 28, 2014 at 14:25
  • That is a great idea, but unfortunately each website goes to a different subfolder/file, for example imagine some of the sites are besthairdresserinlondon.com, besthairdresserinputney.com and besthairdresserincamden.com then they would link to bestinclass.com/hairdesser/london, bestinclass.com/hairdesser/putney and bestinclass.com/hairdesser/camden. The days of having loads of websites with similar content for good seo are gone and we're trying to fix it all.!
    – JayUK
    May 29, 2014 at 20:52

Not the answer you're looking for? Browse other questions tagged .