Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Related to another question - if you need to get URL rewriting implemented ASAP, what are some methods that you've used or know of that can speed this up?

share|improve this question
    
I don't understand this question. The way you do it depends on what webserver you are using. "Quickest" - well whatever way works with your webserver. "Cheapest" - you want a list of services of people who'll do it for you? –  delete Jul 9 '10 at 0:19
    
Cheapest and Quickest usually relate to the same thing if you're a webmaster because time == money. This is about fast-tracking url-writing implementations if you're not really sure where to start. –  Mark Henderson Jul 9 '10 at 0:20
add comment

1 Answer

up vote 2 down vote accepted

We managed to do several hundred products in under 8 hours. Here was our scenario:

We had:

  • Dog ugly URLs that were filled with meaningless parameters
  • In-house developers
  • Full access to the SQL database and schema
  • IIS6/ISAPI Rewrite (but we could have done this for others)

Option 1

Our products table looked like this:

ID | Product Name | Description | etc
-------------------------------------
001|Product 1     | This is...  | etc
002|Product 1     | This is...  | etc
003|Product 1     | This is...  | etc

So we wrote a small batch program that would loop through our products table and create entries in our httpd.ini file (ISAPI Rewrite's version of .htaccess), so that we ended up with a file with hundreds of entries like this:

RewriteRule (/product-1/) /DLLFolder/Requester.dll?APPLICATION=MyApp&PROGRAM=Products&ARGUMENTS=-N001 [I,O,U] * Please see disclaimer

Our products don't change very often, so we just re-run this manually each time we added something. Not elegant, but this is about getting it done quick/cheap.

Then, everywhere that our links were printed to products, we just made sure that the links were outputted to their full URL.

This took about 8 hours in total.

Option 2

A single generic URL Rewriting rule that looks something like this:

RewriteRule (/products/)(.*/)(.*) /DLLFolder/Requester.dll?APPLICATION=MyApp&PROGRAM=Products&ARGUMENTS=-N$3 [I,O,U] * Please see disclaimer

This meant we could write:

/products/my/thing/whatever/the/hell/i/want/123

And it would rewrite to the correct URL. Then it's just a matter of changing the output of your URL links.

* DISCLAIMER: My regex skills are very rusty and I made those up on the spot. They may be wrong. Your milage on the actual regex's may vary, but the concept still stands.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.