Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

What is the best method of redirecting deprecated pages?

Apache/ Linux



6:52 pm on Aug 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

I have a new site that is going live at the end of this month.

The old structure was terrible and I decided despite reasonable amounts of SE traffic that it will be more worthwhile to scrap the old url's and start from scratch.

Anyhow....I have one set of about 10 pages that does well for "event widgets" term....or "pictures of event widgets".

When the new site goes up there will only be one page (for a little while), and I will be rebuilding the set of pages at a later time.

I digress.....
I know that there are a couple ways to do redirects.....what would be the best for this situation, and can you point me in the direction of a tutorial?

[mydomain.com...] etc.
will point to


8:44 pm on Aug 14, 2003 (gmt 0)

10+ Year Member

i'd look into mod_rewrite for this one... if the samples you gave are representative of the actual ones you're moving, something like this may do it for you...

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_URI} ^/event-widgets\.htm$ [OR]
RewriteCond %{REQUEST_URI} ^/event-widgets([0-9]¦[1-9][0-9])\.htm$
RewriteRule .* http://www.mydomain.com/event-widgets/event-widgets.htm [R=301,F]

those regexps are the trick... i'm sure that the two conditions could be combined into one but wasn't able to figure it out "on the fly"...

if i've got it right, it says that /event-widgets.htm is to be redirected and /event-widgets0 thru 99.htm are to be redirected... i used a 301 code for a permanent redirect...

the numerical regexp allows 0-9 or 10-99... if you actually have 00, 01, 02, 03, then using [0-9][0-9] instead of (blah¦blahblah) will cover all two character numericals...

if you have three character numericals, you should easily see the method to include 100-999 ;)

please note that you'll have to use the real verticle bar (aka pipe) if you cut and paste this... the board alters the pipe to a solid one instead of the broken one...

[edit: cleaned up code mistakes]


2:50 pm on Aug 15, 2003 (gmt 0)

10+ Year Member


that last line should end in


L for Last not F :(

[the edit button's gone away so i can't edit it right in the message]


3:43 pm on Aug 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Thank you for the suggestions.

I am not very knowledgeable of my webserver....where would I place this code?

In the .htaccess file of the root webserver directory?

I have other pages that would be nice to redirect as well....If I have 20 or 30 redirects is that going to slow the site down quite a bit?

I have about 6 other "mainpages" that would be nice to do permanent redirects on also, but not at the expense of performance.


4:21 pm on Aug 15, 2003 (gmt 0)

10+ Year Member

yes, the ones i showed are for the .htaccess file... they should work if your server is apache oriented and is configured for .htaccess use...

there should not be any noticible difference in speed... not unless you get something goofed and toss the server into a rewrite loop... i've done that a time or two and was glad i had access to the server to stop the apache process and restart it...

you shouldn't have any problems rewritting and redirecting many pages... i'd list each group in a block that's commented as to what it is for... then, you can watch the logs for when those redirected pages aren't being called any more and trim that code out after a while...

the two or three lines at the top of the example i showed you are only needed in the file once...

if the site listed in your profile is the one you are working on, it is an apache server (i peeked at the headers ;)) very nice site and topic... excellent job...


Featured Threads

Hot Threads This Week

Hot Threads This Month