Moving Entire Web Site

Topics: Developer Forum, User Forum
Jun 9, 2007 at 12:49 PM
Going to be moving our entire website to a content management system. The system will force us to use page numbers for each page. We've got a couple thousand pages to move, so we can't do it all at once.

What I'm planning on doing is creating a form which will allow us to store the old URL and the new page number for that page. Once a day, I'll go though the database and rewrite the ini file on the fly.

Question 1: Does the above make sense?

Question 2: What type of expression will I need to use to redirect

/oit to /pages/108.asp
/oit/faq to /pages/109.asp
ect... for all the pages on the entire web server.

Jun 9, 2007 at 2:24 PM
Edited Jun 9, 2007 at 2:26 PM
Hi there...

You'd have to match each URL to it's processing page - which in your case, would be unreasonable.

You wouldn't want to keep constantly updating Ionics each time a page is posted...

RewriteRule ^/oit/ $ /pages108.asp
RewriteRule ^/oit/faq/$ /pages109.asp

That'd be a pain!

The big thing here is to pass at least the page name in the URL such as:




The text at the end of the URL is just to make it pretty and readable...

If we pass at least the page name, we can generalize our rule assuming that all processing is done from the /pages directory.

So your rule would look like this:

RewriteRule ^/oit/(\d)+/(?:\w)+/$ /pages/$1.asp

It reads: any requested URL matching /oit/123/page_title/ will be processed by /pages/123.asp. The page title is matched but not captured. It's just "for looks".

You need to at least pass your page's name in order for this to work otherwise, like I said, you'd have to write a thousand rules and I don't think that'd be very officiant.

Best of luck
Jun 13, 2007 at 12:05 AM
I Think what the original poster (lucasstark) had in mind is generating the IIRF ini file mechanically, based on the content of the database, which stores the state of the migration.

There's nothing technically wrong with the approach he proposed, although, as the readme states, I have done no perf testing on IIRF and certainly I wouldn't want to guess how this thing would perform under load if you had 1000's of pages redirected like that in a single ini file. I'd like to find out though! it wouldn't hurt to try.

In answer to lucas' question, the RewriteRules should be something like mcwilliams132 suggested, except I would add in an L (meaning, "last rule to apply"), on each RewriteRule. This means, as soon as you get a match, stop trying to find more matches, and don't recurse. That would cut the processing path significantly I would think.

Let us know how it goes?