Jump to content

generate URL


sleith

Recommended Posts

no you would not need to create a sub-directory for each

user, it can be done with .htaccess

 

ex:

RewriteEngine on
RewriteRule ^([^/\.]+)/?$ users.php?user=$1 [L]

 

this will display as:

http://www.website.com/username

 

and send "username" to

users.php as an $_GET variable,

so you can call it with

echo $_GET['user'] in users.php

 

Thanks about the info. I'll learn about RewriteEngine

Btw, how about url on subdomain level like thedudeoforkut.multiply.com ?

Link to comment
Share on other sites

Here a little fast example you can also do.......

<?php

$i=array("peeter"=>"00005","paul"=>"00006","harry"=>"00007","john"=>"00008");

foreach($i as $username => $id){

echo"<a href='".$_SERVER['PHP_SELF']."?profile=$username'>$username</a><br><br>";

if($_GET['profile']=="$username"){

switch($username){

case $username:

	echo "your name is $username with id $id <br><br>";

	brake;
}
}
}
?>

Link to comment
Share on other sites

Here a little fast example you can also do.......

<?php

$i=array("peeter"=>"00005","paul"=>"00006","harry"=>"00007","john"=>"00008");

foreach($i as $username => $id){

echo"<a href='".$_SERVER['PHP_SELF']."?username=$username'>$username</a><br><br>";

if($_GET['username']=="$username"){

switch($username){

case $username:

	echo "your name is $username with id $id <br><br>";

	brake;
}
}
}
?>

 

it is to do like "www.xyz.com/username=sleith" right?

i already know that one. i need to directly "sleith.xyz.com"  :P

 

That would work the same way, but then you need to make sure that all subdomains are handled by the same vhost.

Thanks for the info  ;D

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.