Forum Moderators: phranque
Old site: [oldsite.com...]
New site: [newsite.com...]
It's pretty straightforward as you can see, and it's only for a portion of the old website (the rest is staying at the old domain). I've seen 301s done a couple different ways - could someone tell me which is the real, right way? Thanks!
It's not clear from your example which parts of the old and new URL-paths are fixed, and which parts (if any) are variable. If you just want to redirect a few URLs, then a simple list of case-by-case redirects would work.
If you want to redirect groups of URLs, say entire directories or URLs that all have "blue_widget" anywhere in them, then one approach might have an advantage over the other.
Taken literally, but assuming that all "pages.htm" in the /folder directory are to be redirected unconditionally, your example would be easiest to implement using the most-primitive redirect directive of Apache mod_alias:
Redirect 301 /folder/ http://www.newsite.com/folder/
If you need to remove part of the original URL-path, or if you need to use regular-expressions to match certain 'kinds' of URLs, then the RedirectMatch directive would be a better choice. If you need to redirect depending on certain conditions of the request environment itself (say, redirect only for AOL users), then mod_rewrite would be better. And if the new URL cannot be directly-derived from simple substitution or rearrangement of the characters and fields of the old URL and request variables, then a scripted database lookup approach might be required.
Each of the above-listed methods brings increasing felxibility *and* complexity in turn.
Jim