Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7932475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:01:56+00:00 2026-06-03T21:01:56+00:00

An example for my question: I’ve a script in the document root (htdocs or

  • 0

An example for my question:

I’ve a script in the document root (htdocs or what ever) for the domain (as example) “root.co.uk”, where I want to generate a link to the “file” domain:

/htdocs/include.file.php

<?php
  echo $_SERVER['HTTP_HOST']; // another.com -> but I like to have "root.co.uk" here :(
?>

And now I’ve a subfolder for the domain (as example) “another.com”, which will be loaded via browser:

/htdocs/another.com/index.php -> http://www.another.com

<?php
  include('/htdocs/include.file.php'); // Include file from "root.co.uk"
?>

Is there any way to pass the domain name? The only solution, as far as I see, is to define a var like $maindomain = ‘root.co.uk’. But thats not the way I like to do it. 🙁

Thanks for any ideas!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T21:02:00+00:00Added an answer on June 3, 2026 at 9:02 pm

    No, this isn’t possible.

    There is no reference from within your PHP files to the web server configuration that specifies what files are in the docroot for the domains being served. Any $_SERVER variables are passed to PHP from the web server for the one request that was made. Including files does nothing more than include them to execute, which means they will run in the context of the initial request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have question for example i want to implement binary tree with array i
simple Python question: Example list: A = [1,2,3,4,5] I need to generate another list
-Edit- Alternative question/example How do i cast A to object to class A when
I cannot find a simple example about my question above: how can i detect
The question may be a little vague but here's an example of what I
Question: Does anyone have an example of a filter as you type dropdown control
Noob question for Ruby on Rails- here's an example of my situation: If I
Question about assignments and variables (* For example *) SP = SparseArray[{},5] or SP
This is a simplified example to illustrate the question: class A {}; class B
Check this example before reading the question - http://www.sqlfiddle.com/#!2/fcf3e/8 The following data comes from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.