Jump to content

Wiki like url? get variables from URL


sdlyr8

Recommended Posts

Hey, I've always wondered how its done. How does a page like www.domain.com/username know which user's profile to load? I know about GETs and POSTs, but how does one make a script like that? Basically the same deal with on wikipedia's site. Let me know if i'm not making any sense.. thanks!

Link to comment
Share on other sites

If it just has http://domain.com/username besides using PHP to get the variable they're most likely using mod-rewrite to modify the URL. A normal url would look like http:/www.domain.com/somefile.php?variablename=value . Then in PHP to get that varaible you'd do:

 

$variable = $_GET['variablename'];

 

So in your example, www.domain.com/username, mod rewrite would be used and basically change the way the server sees that URL, most likely 'hiding' something like username=, allowing www.domain.com/?username=username to just be domain.com/username

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.