Results 1 to 5 of 5

Thread: Mask external url

  1. #1
    Join Date
    May 2010
    Posts
    30
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Question Mask external url

    Hello,

    My site contents were hosted under a different domain and I want them to appear on my main domain, Is there any way to do this with the ff url format?

    http:// myMAINsite.com/contents.php?go=http://myOTHERsite.com/somecontents.html

    The above url format works fine using frameset but I want the url from my other site to be a relative url like the url format below.

    http:// myMAINsite.com/contents.php?go=/somecontents.html

    As you can see, I want to hide "http://myOTHERsite.com" to avoid long urls...

    Thank you in advance!

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    Why do you have content spread over 2 domains? Wouldn't it be easier to move it to the same domain (that would make relative URLs possible)? Is the content entirely yours - linking to another domain but wanting to try and hide it looks a bit questionable?

    Please provide a link to the site so we can assess the problem fully.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    In your contents.php page, just set a base url for it to work off:

    PHP Code:
    <?php

    define
    ('BASE_URL''http://myOTHERsite.com');

    if(isset(
    $_GET['go'])) {
      
    header('Location: ' BASE_URL $_GET['go']);
    }

    ?>
    Last edited by Schmoopy; 12-05-2010 at 10:49 AM.

  4. The Following User Says Thank You to Schmoopy For This Useful Post:

    william james (12-10-2010)

  5. #4
    Join Date
    May 2010
    Posts
    30
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Thank you sir for your help, it works!

    I can now use

    http:// myMAINsite.com/container.php?go=http://myOTHERsite.com/base_url.php?go=contentOFothersite.html
    or

    http:// myMAINsite.com/container.php?go=base_url.php?go=contentOFothersite.html
    I prefer the 2nd url format since it is shorter.
    -----------------------------------------
    But is there any way to combine the php code of the "container.php" and the "base_url.php" ?

    the code of the "container.php" below
    <iframe src="<?php echo $_GET['go']; ?>" scrolling="no"></iframe>
    basically I want the content to be shown inside an iframe

    If there's no solution then im still happy using the url format above

    By the way the content of my site was hosted in http://myotherdrive.com
    I think theres no problem hiding their url since Im paying for it for a yearly basis.

    Thank you again and more power and good health to you!
    Last edited by william james; 12-05-2010 at 10:39 PM.

  6. #5
    Join Date
    May 2010
    Posts
    30
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Hi Sir,
    Base on your code I finally came out with a solution! Thank you again!

    whatever.php
    <html>
    <head>
    <?php
    echo "<base href=\"http://myotherdrive.com/\" />\n";
    ?>
    </head>

    <body>

    <IFRAME SRC="<?php echo $_GET['id']; ?>" WIDTH=550 HEIGHT=400></IFRAME>

    </body>
    </html>
    url format:
    http: //myMAINsite.com/whatever.php?id=myotherdriveContent.html
    Last edited by william james; 12-05-2010 at 11:46 PM.

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
  •