views:

12

answers:

1

I've been seeing this type of url: http://someurl.com?someid=4387&anotherid=1234&yetanother=7365456

And I've seen a modification of that url like this: http://someurl.com/4387/1234/7365456

Also I think I've seen it like this too: http://someurl.com/4387/1234/?yetanother=7365456

What exactly is this called? And is this recognized on the server side? Or in the website scripting?

I'm thinking I want to do this for a project of mine. I am using a url with a few variables after the ? question mark. I'd like to make one of those variables part of the url in that directory format, while the rest can come after the question mark.

I'm running Apache and PHP. I'm gonna guess it has something to do with mod_rewrite, but I'm only guessing. What actually recognizes the variables inside the url like that?

A: 

These are generally labelled "friendly URLs".

You would use mod_rewrite to direct the requests to a script (PHP for example). You could either rewrite directly to your script and let PHP examine the request using values in the $_SERVER array

RewriteRule ^.*$ index.php

or capture and set the requested URL as a parameter for the script, eg

RewriteRule ^(.*)$ index.php?req=$1
Phil Brown