URL Rewrite rules

I have never written htaccess rewrite rules before.

I need this url

http://mysite.com/view_retailer.php?rid=770

rewritten to

http://mysite.com/retailer/{What ever is the title in the rid770 database}

and this url

http://mysite.com/retailers.php?cat=39

to

http://mysite.com/{the category title that is in the database cat=39}

Thanks

If your new URLs require a database lookup, then you can’t do it with rewrite rules. You’ll have to generate the redirect response with PHP.

RewriteMap WILL do that if you have access to the server or vhosts file. However, because any coding error can bring down the server, you should not attempt this unless you know what you’re doing.

You can do the same thing, though, using a PHP handler file (redirect to the handler thence on to the file you want to serve based on the input). I’d covered this before in this board and it should also be in the tutorial linked in my signature. FWIW, I call it a “Poor Man’s RewriteMap.”

Regards,

DK