Results 1 to 4 of 4

Thread: My Web Address

  1. #1
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default My Web Address

    Hello everyone,
    I asked this a while back and someone said it wasnt possible but i know it is, because i visited a site in the past that was like this so maybe if i can explain it better someone can guide me to the right direction, how do i create a php file where it retrieves the a link that i posted and when someone clicks it, it opens it up and display it within the same site name just attaches the url to the end of my websites name. Kind of confusing of how im imagining it so let me make a full description:

    If my site is www.Site.com and i post a link like"Google.com" how can i make it display the website within my own window on site.com and have the adress display as www.Site.com/file.php?=google.com if that makes any sense?

    Im doing this because i want my users to always remain on my site when they click a link that i posted!

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    simply write the link that way ( <a href="http://www.mysite.com/links.php/www.google.com">link</a> ). you can use php (or, javascript might be more appropriate) to get the other site's address (in php, you would use $_SERVER['PATH_INFO'] ) and display it in an iframe on your page.

    However, it seems troublesome and unnecessary. If you show them the page, they've still "left" your site (unless you actually scrape the content and generate your own page from it, a practice which is for losers). The fact that they're still "on" your site as well accomplishes little, especially once they start clicking links in your iframe.

    If you're trying to offer references to other sites, but don't want users to "lose" or forget about your site, it would be more effective to simply have the links open in a new window (tab, depending on browser preference), leaving your page undisturbed. Twitter is a big believer in this method, for example.

  3. #3
    Join Date
    Jan 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hey thanks for replying

    I have a site that just simply post links to other sites that contains interesting news that i want to share, but when ever i post a link it goes to that site, so if anyone copies that link and post it to a site like facebook.com they wouldnt know where the link actually came from (my site) if that makes any sense. basically i want recognition for all the links i find to drive traffic to my site so thats why i am doing it this way

    is there a site or something i can search google for to get more information on how to do $_SERVER['PATH_INFO'] and how to build that php file?

    thanks again!

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    if you have a link like so

    <a href="http://www.mysite.com/links.php/www.google.com">link</a>

    then links.php should read something like this:
    PHP Code:
    <?php
    if(!empty($_SERVER['PATH_INFO'])){
      
    $src "http://".$_SERVER['PATH_INFO'];
      echo 
    '<iframe src ="' $src '" width="100%" height="300"></iframe>';
    }
    you'll have to check if and how your server sets the path info variable (some don't), and remember to write all the links is the same way (if some are written with the http:// and some are written without, you'll have to check each time and build the $src variable correctly).

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
  •