tags:

views:

97

answers:

4

I have a website say domain.old hosted with say 'host-old'

I want to do away with 'host-old' and go with 'host-new'

(so effectively 'host-old' hosting would end)

Also I want a new domain - say 'domain.new'

So now I have 'domain.old' , 'domain.new' and 'host-new' with me

Now I want all my old links are preserved:

viz. http://domain.old/cat1/link1/page1/

redirects to http://domain.new/cat1/link1/page1/

Now please advice what would be the best way to go to set up with the new host.

A: 

i don't know exactly how this would work but you could parse the URL from the old site and redirect to your new host. You need a common script in your domain.old masterpage that does this for you.

Konstantinos
If domain forwarding of domain.old is done to domain.new leading to a php page in domain.new hosted with host-new. Could such a php page be used for doing a 301 redirect?Would it work?
Anup
in which framework has the domain.old been written?
Konstantinos
its php - wordpress on linux apache
Anup
then some apache configuration may do the job, check Stobor's solution
Konstantinos
A: 

The question would be easier to answer if you specified your platform. If you are on Apache, I'd take a look at mod_rewrite

You'll probably want to provide a 301 (moved permanently) http response.

Jan
Yes its Linux Apache server. The point is I would like 'host-old' to lapse. If that is so - then where I put the .htaccess? - that is the problem.
Anup
A: 

When you get rid of the old domain, you can't control it any more, and therefore won't get traffic from it. You should transfer the old domain to your new host (not too hard), and then have a redirector running on it - the way other answers suggest.

Piskvor
But how do I set a 301 redirect set for the search-engines sake in such scenario?
Anup
+4  A: 

This is a multi-step process:

  1. Create all the pages at 'host-new' so that 'http://domain.new/cat1/link1/page1/' all work.
  2. Enable mod_rewrite in Apache on 'host-new', and configure as below.
  3. Change the dns entries for 'domain.old' to point to 'host.new'
  4. wait 2-3 days for dns entries to propagate to remainder of the internet.
  5. stop hosting at 'host-old'

The mod_rewrite config you need is:

LoadModule rewrite_module modules/mod_rewrite.so
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain.old$
RewriteRule ^(.*)$ http://domain.new/$1 [NE,R=301,L]
Stobor