Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jun 2006
    Location
    UK
    Posts
    922
    Thanks
    302
    Thanked 3 Times in 3 Posts

    Question PHP: Fetching foldername from URL

    Hi,

    I came up with this problem last night.

    I have a URL http://www.mysite.com

    How do I fetch the folder name that was supplied in the URL.

    For example:


    http://www.mysite.com/xyz
    or
    http://mysite.com/myfolder
    or
    http://www.mysite.com/xxx


    Please note that I can either use www or http://www or just http:// in my domain name but I need to fetch the folder name that was supplied in the URL.

    PS:

    I tried the following code, but it didnt revealed the foldername supplied

    Code:
    <?php
    echo $_SERVER['HTTP_HOST'];
    ?>


    Please help.


    Thanx

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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