View Full Version : Mask external url
william james
12-05-2010, 07:09 AM
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!
Beverleyh
12-05-2010, 10:23 AM
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.
Schmoopy
12-05-2010, 10:30 AM
In your contents.php page, just set a base url for it to work off:
<?php
define('BASE_URL', 'http://myOTHERsite.com');
if(isset($_GET['go'])) {
header('Location: ' . BASE_URL . $_GET['go']);
}
?>
william james
12-05-2010, 06:12 PM
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! :)
william james
12-05-2010, 11:26 PM
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
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.