Jump to content


Photo

Dynamic URLs


  • Please log in to reply
4 replies to this topic

#1 bcoffin

bcoffin
  • Members
  • PipPipPip
  • Advanced Member
  • 130 posts

Posted 11 September 2006 - 07:34 PM

I'm building an intranet for my company and want to be able to give my coworkers (there are about 150) the ability to create their own news/photos pages. I took a look at MySpace and certainly don't want anything that complicated but was wondering how they do the dynamic URLs part..

ie: if my site lives at:
http://intranet/

how do I configure my web server (or better yet, just the PHP code), so that if an employee does create his own page, then I can use:

http://intranet/alan
http://intranet/betty
http://intranet/charlie

and have that URL actually resolve instead of say "Page Not Found"

I'd rather not create all these web directories one by one, or even have the php create them and copy the necessary scripts into the folders. Is there a way to use apache look-back, or php $_SERVER global to just place the script in the webroot and grab these values?

Thanks all,

benny
Ben Coffin
bcoffin@hotmail.com

#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 11 September 2006 - 07:36 PM

you'd want to use mod_rewrite most likely. that way, you could pass a variable through the URL and have it rewritten into whatever pattern you'd like on the server.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 bcoffin

bcoffin
  • Members
  • PipPipPip
  • Advanced Member
  • 130 posts

Posted 11 September 2006 - 07:39 PM

very cool.. that's just one .htaccess doc, then, rather than a ton of other bs.
Thanks for the suggestion -- I'll google around for docs on that, do you have any handy?

Benny
Ben Coffin
bcoffin@hotmail.com

#4 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 11 September 2006 - 07:45 PM

check out this tutorial from right here at phpfreaks
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#5 bcoffin

bcoffin
  • Members
  • PipPipPip
  • Advanced Member
  • 130 posts

Posted 11 September 2006 - 08:24 PM

Looks like just the gem I'm looking for!
Thanks again obsidian.
Ben Coffin
bcoffin@hotmail.com




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users