At 14:38 18-3-03, you wrote:
Ok, I hope this makes sense,

When a user 'registers' with our site, I want to generate their personal
webpage for them.  Currently, I have a webpage where the contents are
generated from their personal info in the db and I have a drop down to view
client pages but it is just the same page but I pass in the clientid so it
will display their data.  This is fine but I want the users to be able to
tell others.."Visit my home page at www.eddiessite.com/Johnny  or something
like that...I don't want them to have to say visit my page
www.eddissite/client_pages?clientid=43  does that make sense?  Should I just
generate a folder for them with an index page that redirects then to the
clientpage with their id?

wow wouldn't that create a huge directory structure!


this is the way i did it, to be able to make all sorts of fake urls, from /page/33 to /person/3 or person/jones or even /jones if you want.
You need a server that is setup to read .htaccess files.


In the .htaccess file for your site, you write
---------------
ErrorDocument 404 /subdirectories/to/redirect.php
---------------
This way all the urls that would normally be led to a 404 warning page, are now first led to a php file. It is VITAL to not use the complete URL but only the part after www.domain.org, otherwise you loose all existing form and url information.


In redirect.php you check your url and split it up. You can do this any way you like. I'll show some usefull examples:

---------------
<?PHP
$basis='http://www.sense.nl/';   //my base url to build the links on.
global $_SERVER;
$path=trim($_SERVER["REQUEST_URI"]);
$path_bits=explode('/',$path);

switch (strtolower($path_bits[1]))
{
case 'educationworkshop':
Header("Location: ".$basis."index.php?module=ContentExpress&func=display&ceid=15");
break;


case 'news':
Header("Location: ".$basis."modules.php?op=modload&name=News&file=article&mode=nested&order=0&thold=0&sid=".trim($path_bits[2]) );
break;



case 'research':
case 'researcher':
case 'researchers':
case 'researchguide':
case 'research_guide':
Header("Location: ".$basis."redirect/research.php?".trim($path_bits[2]) );
break;



default: Header("Location: ".$basis."redirect/404.html");

}

?>
---------------

As you can see i simply split up the url on the slashes.
Some words, for example 'educationworkshop', lead to a fixed page. I have a whole bunch of these, very useful. Leads to: http://www.domain.org/educatiionworkshop



'news' expects an extra value like http://www.xx.org/news/11, then leads directly to the long url.


'research' and a couple of lookalike words are forwarded with the extra data to another PHP file specialized in selecting the descriptions, just as you want.

in research.php i then look:
 is the extra data a number ? then go to the url.'&ID='.$thenumber
 is it a word or phrase? then do a query to find the right number

The last one is the one you could use. For instance if it finds
http://www.domain.org/research/jones,
a query is made that looks up Joneses. If there is only one Jones, get the ID number and show the Jones directly.
If not, show a list of Joneses with links made with their respective ID numbers.



Chris








--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to