Mobile app version of vmapp.org
Login or Join
Murray432

: What's the quickest/cheapest way to get URL rewriting implemented? Related to another question - if you need to get URL rewriting implemented ASAP, what are some methods that you've used or know

@Murray432

Posted in: #Automation #UrlRewriting

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray432

1 Comments

Sorted by latest first Latest Oldest Best

 

@Murray432

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 [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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme