htaccess Question

2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 23, 2016   (RSS)

By gregThomas - February 23, 2016

Hi Dan, 

I've done some research into this, but it doesn't look like there is an easy way to do this with .htaccess. Apparently the p tag can be used in rewrite rules to make the server connect via a proxy, but I couldn't get it working on my test machine. You can read about this here:

https://httpd.apache.org/docs/2.4/rewrite/proxy.html

Another solution would be to create an index.php script on NewspaperSports.com that gets the contents from www.newspaper.com/sports/ and displays it using CURL:

https://davidwalsh.name/curl-download

If you have a CMSB installation on NewspaperSports.com, you'd be able to display the contents using the built in getPage function:

  // load viewer library
  $libraryPath = 'cmsb/lib/viewer_functions.php';
  $dirsToCheck = array('C:/wamp/www/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
  
  list($html) = getPage('http://www.newspaper.com/sports/');
  echo $html;

Something you'll have to consider with all of these solutions is that the the tags that load JS, CSS, images, etc would need to have absolute URL's on www.newspaper.com/sports/ for the content to load correctly. 

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com