SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2007
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Changing my URL (address) with PHP .... ?

    Real simple question I am sure.

    I am using a $_GET function to load mysql data onto a page.

    The url that Calls the information reads something like this ::: http://examplesite.com/?dbvariable=bill

    Everything on the page loads up fine; MY question is, how would I code my script so that http://examplesite.com/bill - does the same things that the previous url does (load all information in my database, connected to 'bill' --- which of course would change dynamically, if instead of 'bill' it were to read 'john' - now it will pull all johns' info.

    I am sure this might have been covered before; I just don't quite know what 'term' to use to properly find my answer; I know it's do-able!

    Thanks in advance to anyone who understands this question; and can provide any solutions... or at least, point me in the right direction.

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2007
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    p.s. please do not lick those links............ just examples.

  3. #3
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You'll need to look in to mod_rewrite and .htaccess to do things like this. It can't be done without as the server will expect a default file to be in the folder /name

    .htaccess, unlike global.asa in asp, gets called before any files do. So you can use that with mod_rewrite to send data as though it was coming from a default file
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  4. #4
    SitePoint Enthusiast
    Join Date
    Oct 2007
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that makes sense; I might look into that then instead .....

    i was also wondering if there is a way to Shorten /?dbvariable= .... to something like /?u=

    where the string ?u is = to ?dvariable

    for something like that, am I looking at using String Replace??

    is that even possible? - because if I can shorten the link, that would be better, than changing how the site reads for files/folders I am thinking; thanks again for any help or points provided.

  5. #5
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,680
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    kingc,

    Mark was correct. You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It's helped may members and should help you, too.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •