Get Current URL and mod_rewrite

Discussion in 'PHP' started by trixs, Jul 21, 2007.

  1. #1
    Hey all,

    I wasnt sure if I should post this here or mod_rewrite..

    Anyway, how can we get the actual URL displayed in the users browser window. I need to get this and not the url prior to mod_rewrite for redirect reasons..

    Everything I do seems to get the prior mod_rewrite url IE: www.#.com/users.php?bleh=1

    But I want:

    www.#.com/users/1 which would be displayed to the User ----

    Any ideas?

    Of course I could write my own class to accomplish this -- Im just trying to save myself some heartache :D
     
    trixs, Jul 21, 2007 IP
  2. decepti0n

    decepti0n Peon

    Messages:
    519
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Try $_SERVER['REQUEST_URI'] or $_SERVER['REDIRECT_URL']

    I just threw up a quick page, used print_r($_SERVER); and found it in there :)
     
    decepti0n, Jul 21, 2007 IP
    trixs likes this.
  3. trixs

    trixs Peon

    Messages:
    111
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Finally got around to fixing this portion of my script and your solution works great.

    Thanks,

    Trixs!
     
    trixs, Jul 28, 2007 IP