Forum Moderators: phranque

Message Too Old, No Replies

Rewrite versus Redirect

Which to use and when?

         

gijimbo

12:44 am on Jul 18, 2005 (gmt 0)

10+ Year Member



I have been reading numerous posts and library items on the Mod Rewrite. I have seen the word "redirect" used within most of these posts.

So here is my situation: I have completely revamped my site with a completely different directory structure and naming convention. I would like my old pages to be redirected to my new pages. I have figured out how to do that. Whether it is by the book or not I don't know but it works.

Now what is the purpose Mod Rewrite? When the rewrite is done correctly is it solely for telling the server the new name of the file?

If I am correct so far (hopefully), then do I need to create a separate set of redirects for my new pages?

Some clarity would be greatly appreciated. Thanks in advance for your help. :-)

jd01

12:50 am on Jul 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here is some plain english on Mod_Rewrite...

www.webmasterworld.com/forum92/3465.htm

Mod_Rewrite is a more powerful version of Redirect, which can be used to invoke a Redirect - physically change the location in the browser OR Rewrite - serve information to a location from a different location.

In your case you will be redirecting. While you will be able to use Redirect (Mod_Alias) to accomplish your goals, the regular expressions available in Mod_Rewrite should prove beneficial if there is any consistency to your naming structure.

Justin

gijimbo

1:36 am on Jul 18, 2005 (gmt 0)

10+ Year Member



Hello Justin,

Thank-you for the reply. Things are a little clearer. Here is the situation I am looking at as well. My error log is 23.3M and growing just for the month of July. I have thousands of "file not found" errors. Which is true, because I renamed every file.

I am basing this next statement on your reply. I would not need a mod rewrite, correct? I would simply need to do a redirect. If I do the redirect will it clear up those "file not found" errors?

Here is what I have done for one redirect:

Redirect /olddirectory/oldpagename.htm [sitename.com...]

I was waiting for a reply before proceeding to far. Is this ok?

Once again thanks Justin :-)

Jim

jd01

2:29 am on Jul 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, that should work...
It is not as efficient as mod_rewrite, but will do the job.

The only adjustment I see is to define the redirect as permanent (the default is 302, or 'temporary'):

RedirectPermanent /olddirectory/oldpagename.htm http://www.sitename.com/new-page-name.htm

Redirect 301 /olddirectory/oldpagename.htm http://www.sitename.com/new-page-name.htm

Hope this helps.

Justin