How to pull file from another location using htaccess

Discussion in 'Apache' started by myfrogger, Aug 9, 2009.

  1. #1
    I have a php script at www.domain1.com/index.php

    When someone goes to www.domain2.com/index.php I want the domain1.com/index.php script loaded. I do not want it forwarded...I want it to be transparent that domain1.com even exists.

    Is this possible with htaccess? If so, how?

    THANKS
     
    myfrogger, Aug 9, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule (.*) http://www.domain1.com/$1 [R=301,L]

    Put that code in ur domain2 .htaccess
     
    Bohra, Aug 9, 2009 IP
  3. kulinar

    kulinar Member

    Messages:
    45
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #3
    Open index.php of www.domain2.com and inside write
    <?
    include("http://www.domain1.com/index.php");
    exit;
    ?>
    Code (markup):
    Make sure your host allows remote files include.
     
    kulinar, Aug 15, 2009 IP