Welcome to WebmasterWorld Guest from 54.226.194.180

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Mod rewrite help, DB stuff.

Pulling data from DB in the place of rewritten URL

     

manca

4:38 pm on Jul 28, 2006 (gmt 0)

5+ Year Member



Hi guys...I need your help on mod_rewrite issue.
Namely I want to rewrite certian dynamic urls to classic static ones.

The dynamic one looks like:

cx.php?id=543&s=50&t=1

and this code actually redirects surfer to certian site that is under specified id (543, for example). The ids and info about those sites are stored in mySql database. Is it somehow possible to rewrite the url above to the site name, that we would've got from the database?

So if this script is stored in dir: script/cx.php and calling it would cause this action(for each site that is in db is different id): www.domain.com/script/cx.php?id=324&s=70&t=1
and I'd like to see all that rewritten with the actual site url, but however it should pass through the script (because of tracking stuff).

Do you get some idea how could I do that?

Thank you!

jdMorgan

12:25 am on Jul 29, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



You can use the "External Rewriting Program" map-type variation of the RewriteMap [httpd.apache.org] directive, if you have access to the httpd.conf configuration file. Use RewriteMap to call a script which translates the URLs as needed, based on the database.

Jim

manca

10:36 am on Jul 29, 2006 (gmt 0)

5+ Year Member



Hi jdMorgan,

Thanks for the answer. I do have access to my httpd.conf file, but I really don't know how to setup that....do you have some detailed info?

Thanks.

Manca

jdMorgan

3:56 pm on Jul 30, 2006 (gmt 0)

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member



This is pretty much a *project* and not something I can answer with a few short posts. The link to RewriteMap will get you started, and you can follow the research path you need from there.

Jim

 

Featured Threads

Hot Threads This Week

Hot Threads This Month