Forum Moderators: phranque

Message Too Old, No Replies

Use .htaccess

to point all/different page requests to one url

         

Visit Thailand

4:32 am on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have one very old domain, and want to point any people visiting any of the old pages on that domain to just one page (index.htm), telling them to go to the new site.

What would I need to put in a blank .htaccess to make this work without having to do 301's for every single page.

Or is it better to just do one 301 to the main website?

Please take in mind it is an old free domain and the new/main domain is its own well developped .com

Thank you

jdMorgan

5:00 am on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is not a good idea, because your visitors are expecting a specific page. You may also run the risk of a "duplicate content penalty" -- In reality, whichever of those pages has the highest page rank may replace your new index page URL in the SERPs. This is due to the current problems with redirect handling (See other discussions in Yahoo and Google forums.)

Recomendations:

Redirect each old page to an appropriate replacement page on your new site.

-or-

Replace each old page with a short explanation and a link to your new site's site map.
(You can do this using a rewrite of all old pages to a new explanation page on the old site)

-or-

Use a combination of the above, using the second method for old pages which have no reasonable new replacement.

---

OK, now I'l answer your question... :)

Assuming HTML pages:


RedirectMatch 301 \.html$ http://www.newsite.com/

-or-

Options +FollowSymLinks
RewriteEngine on
RewriteRule \.html$ http://www.newsite.com/ [R=301,L]

The first example uses mod_alias, while the second uses mod_rewrite.

Both will redirect any page whose name ends with ".html" to the default page of your new site. You can use php or asp, or whatever extension you need there, the point is to avoid redirecting, say, a jpeg image file request on your old site to your new site's default php page, because that just won't work -- the browsers can't handle it.

Jim

Visit Thailand

5:08 am on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Jim,

I was concerned mainly due to the old sites age, but it was discarded many years ago when the new one (now old - 7 years or so) was created.

The old site only has a low pr, whereas the newer site a much higher good PR.

Have checked the stats and there are few impressions on the old site but still a few are better than none.

So you advise just re-creating the pages and have a simple one liner saying this site/page was discontinued in 97 please go to the current site at...?

Thanks.

Add in - ideally I would just like to redirect all page requests on the old domain to the index.htm still on the old domain which says that everything has been moved to the new domain with an automatic redirect there.

Visit Thailand

5:21 am on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Or would it be simpler to simply delete all the old pages and then create a custom 404 which says all the pages etc etc have moved to this domain click here if you are not redirected within X seconds?

Or is it best to avoid the redirect and let them click?

jdMorgan

5:59 am on Jan 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> Add in - ideally I would just like to redirect all page requests on the old domain to the index.htm still on the old domain which says that everything has been moved to the new domain with an automatic redirect there.

This is approaching what I meant by the note under option #2 above.

> Or would it be simpler to simply delete all the old pages and then create a custom 404 which says all the pages etc etc have moved to this domain click here if you are not redirected within X seconds?

No, never use a custom 404 other than when you want the page marked as Not Found by the search engines. That doesn't mean it's gone, it means it's not findable right now. It might come back. You could use a 410-Gone, but that won't be "followed" to any new URL.

I suppose you could stack the redirects... 301 redirect on the old site all pages to one, then 301 redirect that to the new site. This would give the appearance of the end result of a staged move over time.

I dunno, I think it is best to just let them click, and maybe -- I hate to suggest this 'cause I don't like 'em -- put a six-second meta-refresh on the page, too. Do not use a short meta-refresh, as this will qualify as a 302 with Yahoo's new algorithm.

Jim