Link to home
Start Free TrialLog in
Avatar of Sabrin
Sabrin

asked on

include page with domain

hello,
I have many domains and I would like to include a page
that if comes from domain1.com or domain2.com

make it like this

<? include("http://domain1.com/footer.php"); ?>

<? include("http://domain2.com/footer.php"); ?>

how can i do this?
Avatar of HackneyCab
HackneyCab
Flag of United Kingdom of Great Britain and Northern Ireland image

I'm not entirely clear on what you're asking.

If you want domain1.com to include the file domain1.com/footer.php, but domain2.com to include the file domain2.com/footer.php using the same code, then could you use this:

include('/footer.php');

That uses an absolute path that looks for footer.php in the root directory. So if the current script is in the space for domain1.com, then PHP should ask for domain1.com/footer.php and so on. I think that would work even if the domains were on the same server. (So long as the domains didn't point to the same directory.)
Avatar of Sabrin
Sabrin

ASKER

<? include("DOMAIN WHERE YOU CAME FROM/footer.php"); ?>
Avatar of Sabrin

ASKER

instead of  this
<? include($_SERVER["DOCUMENT_ROOT"]."/galleries/main/header.php"); ?>
/home/etc/site/galleries/main/header.php

i want something like this
<? include($_SERVER["DOMAIN"]."/galleries/main/header.php"); ?>
http://domain.com/galleries/main/header.php
Avatar of Sabrin

ASKER

<? include($_SERVER["HTTP_HOST"]."/galleries/main/header.php"); ?>
only shows this
domain.com/galleries/main/header.php

I need the http://
ASKER CERTIFIED SOLUTION
Avatar of HackneyCab
HackneyCab
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial