homepage Welcome to WebmasterWorld Guest from 54.227.34.0
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
How to get querystring values from mod rewritten url's
compose

5+ Year Member



 
Msg#: 3035492 posted 5:28 pm on Aug 5, 2006 (gmt 0)

Hello,

I used mod rewrite to make my dynamic links to static directory link. My dynamic links was like this -
[mysite.com...]
it takes querysting variable category to generate output on books.php page

Now static dynamic link is - [mysite.com...]

Now i am in confucion how to trape vaue of category variabel in books.php to generate output? becz in urls there is no query string is embeded.

will it be like in book.php to trape category value -
<? $category = $_GET[0] ;?>

Please help.

 

sonjay

10+ Year Member



 
Msg#: 3035492 posted 10:20 pm on Aug 5, 2006 (gmt 0)

Assuming you've written your rewrite rule correctly, you would access the variable exactly as if you were still using the?category=Computer querystring, so $_GET['category'] would = Computer.

You can do a print_r($_GET) on your page to see exactly what GET variables are coming in.

compose

5+ Year Member



 
Msg#: 3035492 posted 5:56 pm on Aug 6, 2006 (gmt 0)

Thanks for reply.

My .htaccess code is -
------------------------------
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^bookinfo/([^/]+)/([^/]+)/?$ /bookinfo.php?$1=$2 [L]
RewriteRule ^books/([^/]+)/([^/]+)/?$ /books.php?$1=$2 [L]
------------------------------

is it ok.

Current dynamic url is -----
[mysite.com...] networking
[mysite.com...]

And i wrote this url to get this url----
[mysite.com...] networking/
[mysite.com...]

So according to this is my .htaccess code is ok?

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