homepage Welcome to WebmasterWorld Guest from
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 / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Writing URI's differently but still accessing $ GET variables

 4:40 pm on Jan 20, 2008 (gmt 0)

Hello, I am wondering how you can dynamically build URI's so you dont have to show the id=3

Given this example URL

How could you dynamically refer to the same information but displayed like this:

So basically dropping the .php from area-information.php, and converting all the variables to look like sub folders?

Any ideas?




 5:44 pm on Jan 20, 2008 (gmt 0)

To access this url:

You may rewrite it as:

You should create an .htaccess file with this content should looks like:

RewriteEngine on
RewriteCond %{REQUEST_URI}!\.(gifjpgphpplswfcsstxt)$
RewriteRule ^([0-9]+)/([0-9]+)/([0-9]+)$ /area-information.html?countryID=$1&stateID=$2&cityID=$3 [L]

(It may not work at once, this is just an example, the idea how it should be.)


 5:47 pm on Jan 20, 2008 (gmt 0)

You could still rewrite the URI as the following:


However you'd have to find the IDs again for that data through your php script. If you can't do this, or it causes too much of a problem, you are probably better off going with the URI format described in the post above.


 6:36 pm on Jan 20, 2008 (gmt 0)

To use eelix format: If the ID exists (as it should) then it could be passed via a SESSION or by a HIDDEN value

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
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