Connecting Tech Pros Worldwide Forums | Help | Site Map

Personalised URL

Dave
Guest
 
Posts: n/a
#1: Jul 17 '05
How does one go about creating personalised URLs

What I want is for the user to go to www.mysite.net/johndoe where johndoe is
a record in MYSQL & then generate an html page on the fly populating the
page with the fields from his record that will say something like "Welcome
John Doe, thank you for visiting your own personal page etc...."

What I dont want to do is have thousands of html pages sitting on the server
waiting for the prospective users to access their pages. It would be a
generic page with certain fields I would like to populate with the specific
data when requested.

The bit that I can't figure out is how to get a request for
www.mysite.net/johndoe to make this happen without tagging johndoe as a
variable eg www.mysite.net/$USER=johndoe

Any ideas?

Thanks

Dave




CountScubula
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Personalised URL


generaly I use an ErrorDucment directive in the httpd conf file the this
document will look at the url and do the apropriate thing.

You can also do something like

http://johndoe.mysite.com

have the index.php page look at the host name (johndoe) and send the
apropriate contents

just do something like this in the httpd conf files
ServerAlias *.mysite.com
DocumentRoot /vhost/mysite/users/


and in dns
* IN CNAME www


--
Mike Bradley
http://www.gzentools.com -- free online php tools
"Dave" <none> wrote in message
news:4059b797$0$23214$c3e8da3@news.astraweb.com...[color=blue]
> How does one go about creating personalised URLs
>
> What I want is for the user to go to www.mysite.net/johndoe where johndoe[/color]
is[color=blue]
> a record in MYSQL & then generate an html page on the fly populating the
> page with the fields from his record that will say something like "Welcome
> John Doe, thank you for visiting your own personal page etc...."
>
> What I dont want to do is have thousands of html pages sitting on the[/color]
server[color=blue]
> waiting for the prospective users to access their pages. It would be a
> generic page with certain fields I would like to populate with the[/color]
specific[color=blue]
> data when requested.
>
> The bit that I can't figure out is how to get a request for
> www.mysite.net/johndoe to make this happen without tagging johndoe as a
> variable eg www.mysite.net/$USER=johndoe
>
> Any ideas?
>
> Thanks
>
> Dave
>
>
>[/color]


Alvaro G Vicario
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Personalised URL


*** Dave wrote/escribió (Thu, 18 Mar 2004 14:51:53 -0000):[color=blue]
> What I want is for the user to go to www.mysite.net/johndoe where johndoe is
> a record in MYSQL & then generate an html page on the fly[/color]

You need Apache web server, one html page and mod_rewrite. The
www.mysite.net/johndoe URL is transformed into
www.mysite.net/show.php?id=johndoe before processing the page and it's
transparent to user. I don't know whether there's a similar feature in IIS.


--
--
-- Álvaro G. Vicario - Burgos, Spain
--
Kevin Thorpe
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Personalised URL


Dave wrote:[color=blue]
> How does one go about creating personalised URLs
>
> What I want is for the user to go to www.mysite.net/johndoe where johndoe is
> a record in MYSQL & then generate an html page on the fly populating the
> page with the fields from his record that will say something like "Welcome
> John Doe, thank you for visiting your own personal page etc...."
>
> What I dont want to do is have thousands of html pages sitting on the server
> waiting for the prospective users to access their pages. It would be a
> generic page with certain fields I would like to populate with the specific
> data when requested.
>
> The bit that I can't figure out is how to get a request for
> www.mysite.net/johndoe to make this happen without tagging johndoe as a
> variable eg www.mysite.net/$USER=johndoe[/color]

What you need to use is $_SERVER['PATH_INFO'].

If your URL is:
www.mysite.net/index.php/johndoe
The script index.php will be run and in that script:
$_SERVER['PATH_INFO'] == 'johndoe';

Dave
Guest
 
Posts: n/a
#5: Jul 17 '05

re: Personalised URL


CountScubula, Alvaro, Kevin

Many thanks for your replys

I now have a good idea of where to start

Regards

Dave


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004


Chung Leong
Guest
 
Posts: n/a
#6: Jul 17 '05

re: Personalised URL


If rewrite isn't installed on the server, you can set the 404 handler to a
PHP page and get the path in $_SERVER["REDIRECT_URL"].

Uzytkownik "Dave" <none> napisal w wiadomosci
news:4059b797$0$23214$c3e8da3@news.astraweb.com...[color=blue]
> How does one go about creating personalised URLs
>
> What I want is for the user to go to www.mysite.net/johndoe where johndoe[/color]
is[color=blue]
> a record in MYSQL & then generate an html page on the fly populating the
> page with the fields from his record that will say something like "Welcome
> John Doe, thank you for visiting your own personal page etc...."
>
> What I dont want to do is have thousands of html pages sitting on the[/color]
server[color=blue]
> waiting for the prospective users to access their pages. It would be a
> generic page with certain fields I would like to populate with the[/color]
specific[color=blue]
> data when requested.
>
> The bit that I can't figure out is how to get a request for
> www.mysite.net/johndoe to make this happen without tagging johndoe as a
> variable eg www.mysite.net/$USER=johndoe
>
> Any ideas?
>
> Thanks
>
> Dave
>
>
>[/color]


Closed Thread