#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    18
    Rep Power
    0
    I've been twisting my mind trying to figure out how to get the real URL. I have a page at namezero which requires you to have a frame_banner at the bottom of the page, thus making it impossible to enter direct URL-adresses. E.g. http://www.metusmortuus.net and http://www.metusmortuus.net/samples.html will both end up at the same page, namely the page that this virtual domain is pointing to. (I hope you understand this)
    What I need is to find the actual URL that was typed into the 'location'-box. Then I would be able to simply redirect my visitors to that page manually. (Yikes, this was hard to describe, but I hope you get the picture)

    None of the predefined variables listed in phpinfo() worked (incl. request_uri and http_referrer), so I guess this is a long shot...
  2. #2
  3. No Profile Picture
    ledjon
    Guest
    Devshed Newbie (0 - 499 posts)
    I understand what you mean, and I think I could do it with perl (cgi), but I'm not that versed in PHP to do tricks like that.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    3
    Rep Power
    0
    Try using the $HTTP_HOST function, eg

    <?php

    echo $HTTP_HOST;

    ?>

    Coopers http://www.phatwap.co.uk
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 1999
    Posts
    114
    Rep Power
    16
    Use a combination of the variables $HTTP_HOST, $PHP_SELF, and $QUERY_STRING

    http://www.php.net/manual/language.v...predefined.php


    Or use parse_url():

    http://www.php.net/manual/function.parse-url.php

    [This message has been edited by scollo (edited July 10, 2000).]
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    18
    Rep Power
    0
    Like I said, none of the variables listed in phpinfo() works... incl. http_host, phpself etc. etc... The HTML file itself resides on a different server, and what I need is the virtual URL... I really don't think it's possible :-(
  10. #6
  11. No Profile Picture
    PHP Developer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 1999
    Location
    EU.NL
    Posts
    10
    Rep Power
    0
    You could try it with JavaScript, but I think you'll get access-errors...
    I've got a similar situation myself, but haven't addressed the problem yet.
    I'll try to come up with something later this week, and if it works, I'll post a solution here...



    ------------------
    Have Fun !

    SJONdaMON
    SDO
  12. #7
  13. No Profile Picture
    ledjon
    Guest
    Devshed Newbie (0 - 499 posts)
    Try REQUEST_URI. I this should be the URI that the visitor typed in.
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    18
    Rep Power
    0
    To explain this a little further. My page is loaded inside a frame (classic URL cloaking) and the frame belongs to the providers of the Domain-forwarding-provider. So request_url would work in the frame (which I don't have access to), but not in my page (which reflects the server that the file is actually stored at)

    That's why this seems hopeless, but the URL remains in the location window (where you type in URL's) so I'm wondering if it's possible to get it in any other way. Like I said 2 times allready, none of the variables in phpinfo() works (which includes all suggestions so far)
  16. #9
  17. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    OKay, well here's a thought, if you are working with a framed document and you want to preven access to a specific frame etc, why not try checking http referrer, look for whatever url you are after.. parse_url() can be set to readily check the referrer, for the specific, if it doesn't match bounce them with a header() call to whatever url you want them to enter from.

    in short, for using http referrer you grab their referrer, and then point them to the main page "if" the referrer doesn't match that page.. etc.

    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.
  18. #10
  19. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    12
    Rep Power
    0
    I'm kinda confused here but maybe this is what your looking for. I'm under the impression you want to get rid of the banner advertisement, so why not use javascript? Just add this code under <./head> [i put the period in case this strips out HTML]...

    <script language="javascript">
    <!--
    if (top.frames.length != 0)
    {
    top.location=document.location
    }
    //-->
    </script>

    That will reload your page in the window, and you wont have the frames...

    Hopes thats helps...
    -Bryan

Similar Threads

  1. Change ip url to domain
    By crypt1c_c0d3 in forum Apache Development
    Replies: 2
    Last Post: January 2nd, 2004, 09:55 AM
  2. Issue with URL address using LWP
    By usaindp1776 in forum Perl Programming
    Replies: 4
    Last Post: September 3rd, 2003, 07:51 PM
  3. mod_rewrite and current URL
    By mikix in forum Apache Development
    Replies: 1
    Last Post: August 4th, 2003, 09:29 PM
  4. URL Handling
    By ranjankumar17 in forum HTML Programming
    Replies: 4
    Last Post: August 1st, 2003, 10:56 AM
  5. Need help: redirect to page based on text in URL
    By JPElectron in forum HTML Programming
    Replies: 2
    Last Post: July 18th, 2003, 11:44 PM

IMN logo majestic logo threadwatch logo seochat tools logo