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
https://forums.phpfreaks.com/topic/163563-wiki-like-url-get-variables-from-url/
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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.