Mod_ReWrite / ReWriteMap a URL using a database lookup script

The Scenario I have completely rewritten an old existing ASP classic ecommerce website over to PHP.

The database design of the previous site had alot of relational ID problems causing troublesome linking of product data rows to other tables in the database.

To get around this I also redesigned the database, giving products new Primary Keys, whilst still keeping a column in the table with the products old PK.

The Problem The problem I have is when the site is relaunched, I need all search engine links that used to point to 'Product.asp?ProductID=29' to lookup the the database, match the products old PK, and redirect to the products new PK i.e. 'Products.php?ID=53'.

I'm looking to do this with Mod_ReWrite/ReWriteMap, however, all documentation I can find online doesn't state how to deal with the database script PK lookup.

Update I've read up further on Ignacio Vazquez-Abrams' suggestion at > External Rewriting Program, and it seems to be correct and the ideal solution. However, after contacting my host, they do not enable ReWriteMap on their servers.

I've supplied my own, but by no means the best/correct solution of achieving this without ReWriteMap enabled.


Your query:


From there just echo the value of ID and a newline, and flush stdout.

Rewrite rules:

RewriteMap dbfixup prg:dbfixup.script
RewriteCond %{QUERY_STRING} ProductID=(\d+)
RewriteRule Product.asp Products.php?ID=${dbfixup:%1}

Need Your Help

Passing options to ffprobe

ffmpeg ffprobe

I'm having problem with the ffprobe syntax, getting print format to output default with no keys. There is a nokey option, so I pass in something like this

Add Features to An Sklearn Classifier

python machine-learning nlp scikit-learn

I'm building a SGDClassifier, and using a tfidf transformer. Aside from the features created from tfidf, I'd also like to add additional features like document length or other ratings. How can I add

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.