homepage Welcome to WebmasterWorld Guest from 54.166.8.138
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Mod rewrite help, DB stuff.
Pulling data from DB in the place of rewritten URL
manca




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

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




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

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




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

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




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

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved