views:

39

answers:

2

Using PHP, how can you make a dynamic folder system, like http://website.com/user/UsernameHere/ show something like http://website.com/user.php?name=UsernameHere

Does this require server configuration, or is it possible with PHP?

+3  A: 

Typically this will rely on some amount of URL-rewriting support from the web server, for instance, some mod_rewrite rule under apache.

Whether or not it's a bunch of complicated rewrite rules, or just a simple one that rewrites everything to /index.php (and let's index.php parse and interpret the URI), doesn't matter.

But you'll need some amount of web server configuration to get it going.

timdev
+1  A: 

There's a few techniques for doing this. It's nearly possible to clean up your URLs using just PHP, but ultimately if you want to get rid of the ".php" extension you'll need to do something with your server. If it's Apache you can clean up using the .htaccess file.

Mark E