Forum Moderators: phranque

Message Too Old, No Replies

rewriterule to newfilenames.htm

         

RoySpencer

5:25 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



I'm new to mod_rewrite, and the Apache documentation is too cryptic for me to figure this out.
I want to redirect all visitors (including SE's) from pages named
State_local_forecasts.htm
to
State_weather.htm
where "State" is a wildcard, e.g. Nevada, South_Dakota, etc.

What is the rewriterule for this? Or is there a better mod_rewrite module to do this? Thanks!

closed

6:34 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



Pseudo-code:
If REQUEST_URI ends with (.*)_local_forecasts.htm, redirect to (value in the buffer)_weather.htm.

That probably sounds cryptic to you, so here's some recommended reading:

You can find a beginner's guide to redirecting URLs here [webmasterworld.com].

Other helpful documents on your way to being an mod_rewrite expert :):

mod_rewrite Documentation [httpd.apache.org]
Regular expressions [etext.lib.virginia.edu]

Or you could just find some similar code in threads here and modify them to make it work.

RoySpencer

8:37 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



Closed:
Thanks much! We implemented it in RedirectMatch, and it worked first time! Woo-hoo!

closed

8:47 pm on Mar 17, 2004 (gmt 0)

10+ Year Member



Well, lucky you. You're supposed to suffer like most newbies are! Congrats, RoySpencer.