Forum Moderators: phranque

Message Too Old, No Replies

htaccess mod_rewrite question - can it be done?

xyz.htm -> index.php?id=xyz

         

jonmayes

4:44 am on Jul 22, 2005 (gmt 0)

10+ Year Member



Hey all,

I'm converting an old static site over to dynamic rendering and want to keep the page extensions the same if possible.

At the moment the pages are stored by product name, e.g. this_product.htm.
All the product names are now stored in a database, but I was wondering if it was possible to retain the page structure by creating a clever mod_rewrite rule?

I haven't worked much with htaccess so I wondered if there's anything I should know before spending the time looking into it!

Thanks guys (and girls, maybe)

Jon

jd01

5:55 am on Jul 22, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, you can. All you need to remember is you will need all the parameters you need for a script to be passed in the URL or to the script in some way.

EG if the DB call is based on id and product name, both must be present in some way in the URL to be passed to the new script. As long as that is present, there should be some way to accomplish what you would like.

This is the longer version of the answer:
[webmasterworld.com...]

Hope this helps.

Justin