Forum Moderators: phranque

Message Too Old, No Replies

Redirecting during an upgrade

How not to get an endless loop?

         

ianevans

1:21 am on Jun 19, 2005 (gmt 0)

10+ Year Member



I figured I'd use the quieter summer days to upgrade both the mysql and php on my site.

I know the process should only take a few minutes if I plan in advance, but during that time I'd like all of the pages on our site to redirect to one page with a "We're upgrading the site, back in a few minutes" message.

We don't have mod_rewrite installed, but I understand that RedirectMatch can be used as well.

I suck at regex so how would I setup the RedirectMatch statement so that it will redirect every other page except for the "be right back" page. Obviously don't want to get caught in an endless loop.

Thanks.

jdMorgan

1:26 am on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you need a conditional rewrite, then mod_rewrite is your only real choice, unless you use RedirectMatch to redirect to a different domain (which avoids a loop).

If you take the second option, make sure you use a 302 or 307 status code redirect, since this is temporary.

Jim

ianevans

2:14 am on Jun 19, 2005 (gmt 0)

10+ Year Member



Just thinking out loud...

We don't have any pages on the site that end in .html, so couldn't the RedirectMatch regex be done in a way so that any url request not ending in .html would get directed to, say, berightback.html

Wouldn't that avoid the looping?

jdMorgan

2:58 am on Jun 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is that you need to express

If NOT "\.html$"
Then redirect

Since RedirectMatch looks for a positive match on a pattern, I don't see how you'd do that.

In mod_rewrite, you can use the NOT operator "!". I don't think that works with mod_alias, but you could try it.

Jim