Forum Moderators: phranque

Message Too Old, No Replies

Yet another/nother/nother 301 redirect question...

Really-this one is different (I think)

         

akmac

8:11 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



Hi!
I'm nearing the end of a very looooooong process in which I'm replacing a static html ecommerce site-with good pr and great serp placement with a dynamic site.

So far, I've been 301 redirecting the individual product pages to their equivalent on the new site, along with a few main category pages. My .htaccess file on the old site is as long as my arm.

At the moment, I'm poised-ready to redirect the remaining main pages to their counterparts, and then implement the redirect of the entire domain.

I have two questions.

#1: Is the correct way to implement the final 301:

redirect 301 / [newdomain.com...]

?

And if so, do I want to place it at the bottom of my .htaccess file so all the previous redirects will still be read? Or does it even matter?

Thanks!

jd01

9:29 pm on Jul 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi akmac,

The correct placement depends on what you want.

If you want the previous redirects to keep redirecting to the current 'new' site, then the final 'catch all' redirect should be last.

If you would like to just use the 'catch all' to redirect everything then you should put it first.

So, really the correct placement is based on the desired effect.

I don't work with Redirect much, but the code appears to need a trailing / on the URL being Redirected to:

redirect 301 / http://www.newdomain.com/

Hope this helps.

Justin

akmac

9:42 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



Yeah, I want all the previous ones to be read so that people bookmarks and such will still work.

Are you sure about the trailing slash? I assumed it would just redirect to the index page with or without it. Something I'm not aware of...?

Thanks for the answers!

jdMorgan

1:38 am on Jul 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Redirect 301 / http://www.newdomain.com/ 

is correct.

This will redirect each page on the old domain to the corresponding page on the new domain, assuming the domains are separately hosted. Any URL-path with a prefix that matches that given on the left will be redirected to the same URL-path on the new domain.

This is done by removing the prefix given on the left from the requested URL, and adding the remainder of the requested URL to the canonical URL prefix on the right. If you omit the trailing "/", then a request for olddomain.com/index.html would be redirected to newdomain.comindex.html, which obviously wouldn't work.

If the domains both resolve to the same "account" on the same server, and you have no access to httpd.conf, then you'll need to use mod_rewrite to test the requested domain and redirect only if the old domain is requested.

Jim

akmac

3:40 pm on Jul 14, 2005 (gmt 0)

10+ Year Member



Thanks guys-added the trailing /. The whole directory structure is different on the two sites, so the only page it will effect is the one JD mentioned. But, that's a pretty important page ;-)

Thanks again!