Personalised URL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave

    #1

    Personalised URL

    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

    #2
    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



    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.c om...[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]


    Comment

    • Alvaro G Vicario

      #3
      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
      --

      Comment

      • Kevin Thorpe

        #4
        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:

        The script index.php will be run and in that script:
        $_SERVER['PATH_INFO'] == 'johndoe';

        Comment

        • Dave

          #5
          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


          Comment

          • Chung Leong

            #6
            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_U RL"].

            Uzytkownik "Dave" <none> napisal w wiadomosci
            news:4059b797$0 $23214$c3e8da3@ news.astraweb.c om...[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]


            Comment

            Working...