By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,851 Members | 983 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,851 IT Pros & Developers. It's quick & easy.

a question about URL formating /category/13/ vs /category.php?id=13

P: n/a
Hello,

I'd like to ask if anyone knows the format /category/13/ where
probably 13 is the ID if it's actually a
directory/file and a script automatically created it when someone
updated his site or they just use
a regex method to extract the number (which means /13/ is virtual), in
our case '13' and then try "select 'bla bla' from table where id='13'
"
which is the same as "$id = $_GET['id'];" with the second type of
formating.
Can I found this, if it is already scripted instead of writing it on
my own?
Any links? Is it hosted in any framework?

thanks a lot

Jan 29 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
just_me wrote:
Hello,

I'd like to ask if anyone knows the format /category/13/ where
probably 13 is the ID if it's actually a
directory/file and a script automatically created it when someone
updated his site or they just use
a regex method to extract the number (which means /13/ is virtual), in
our case '13' and then try "select 'bla bla' from table where id='13'
"
which is the same as "$id = $_GET['id'];" with the second type of
formating.
Can I found this, if it is already scripted instead of writing it on
my own?
Any links? Is it hosted in any framework?

thanks a lot
Hi,

The format /category/13/ CAN be the result of url-rewriting to make it
suitable for apache REWRITE ENGINE (mod_rewrite).

You will most probably find the rewrite rules in your apache config in the
virtual host that defines this website.
And yes, it uses a regular expression.

What is your question/problem excactly?

Try Google: mod_rewrite examples

for a wealth of examples to get you going.

Regards,
Erwin Moller
Jan 29 '07 #2

P: n/a
just_me wrote:
Hello,

I'd like to ask if anyone knows the format /category/13/ where
probably 13 is the ID if it's actually a
directory/file and a script automatically created it when someone
updated his site or they just use
a regex method to extract the number (which means 13 is virtual), in
our case '13' and then try "select 'bla bla' from table where id='13'
"
which is the same as "$id = $_GET['id'];" with the second type of
formating.
Can I found this, if it is already scripted instead of writing it on
my own?
Any links? Is it hosted in any framework?
As Erwin pointed out, this is something handled by mod_rewrite in
Apache (I don't know if there's an equivalent in IIS, and if so, what
it is).
To make /category/13 point open the URL /category.php?id=13, you'd put
something like the following in a .htaccess file in the web root
directory:

RewriteEngine on
RewriteRule ^\/category\/([0-9])+ /category.php?id=$1 [L]

--
Kim André Akerĝ
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Jan 29 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.