php - Using mod rewrite to use urls without query strings -


i trying use mod rwerite cant figure out...

the way understand it, following should possible:

when user clicks on link <a href="/contents/folder/somepage_17">linktext</a> should able make server believe want /contents/folder/somepage.php?id=17 , access query string via $_get in somepage.php file, right?

if so, how put in mod rewrite syntax? also, have lots of pages have dashes in names, i'd have quite high number of urls this-is-a-page_19.

currently, urls have query string in them (like /abc/de/page.php?id=12) i'd have urrls without query string. however, need kind of information, page being called because access database information page (title, keywords, description,...).

help highly appreciated!

this might work

rewriteengine on rewritebase / rewriterule ^contents/folder/somepage_([0-9]+)$ /contents/folder/somepage.php?id=$1 [nc,l] 

and can access var using $_get['id']


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -