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 7737841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:06:34+00:00 2026-06-01T08:06:34+00:00

I have a PHP script (index.php) that includes an index.html file in a sub-directory

  • 0

I have a PHP script (index.php) that includes an index.html file in a sub-directory (site1.com). This index.html file displays images that are located in the same directory (site1.com).

Right now, the index.php file includes the index.html file. The html from index.html is shown, but the images are not. The index.html file is looking in the ROOT directory for the images to display. This is the problem. I’d like to somehow include all contents (??) of the site1.com directory, not just the single ‘index.html’ file.

I’ve tried changing the working directory, but have had no success. Maybe I’m just not using it correctly…

For reasons that I’d rather not go into explaining, I do not want to edit any configuration settings in PHP or Apache. I also would not like to modify the code of index.html. Basically put, I need to find a solution that can be 100% implemented in PHP. The url needs to appear as though the user is still in the root directory (mysite.com) when, in reality, the content from the sub-directory (site1.com) is being shown. This is sort of like a transparent proxy, in a way.

 [FILE] index.php
 [DIR]  site1.com
   [FILE]  index.html
   [FILE]  img1.png
   [FILE]  img2.png
 [DIR]  site2.com
   [FILE]  index.html
   [FILE]  img1.png
   [FILE]  img2.png

I have done plenty of searching, but have not found a working solution.

  • 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-01T08:06:35+00:00Added an answer on June 1, 2026 at 8:06 am

    When you include()/require() a file, it’s as if the contents of that file were literally cut/pasted into the script doing the including. If index.html uses images in the site1.com directory, you’ll have to refer to those image using paths based on the location of index.php.

    The remote user can NOT tell that you’ve included a file from a subdirectory on your site – they’ll just see some html coming back from your server, so if your index.html has something like

    <img src="img1.png" />
    

    in it, but that html is being displayed from the index.php script, then the browser is going to be looking for

    http://example.com/img1.png
    

    not

    http://example.com/site1.com/img1.png
    

    It’s up to YOU to output proper paths.

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

Sidebar

Related Questions

I have an index.php file that loads other php files via this javascript/ajax code:
The setup: I have a standard .php file (index.php) that contains two includes, one
I have this ajax_update script that updates file.php every 60 seconds.. Now file.php outputs
I have a PHP script that processes file uploads. The script tries to organise
I have a PHP script that pushes the headers to allow a file to
I have a first.js file included in the page index.php that have something like
I have an HTML form POSTing to the following index.php: <?php require_once(/home/full/path/to/included/file.php); ?> And
I have an index.php-file, which will echo the string with the returned .html-file prepared
I have php script that creates a temporary watermark image for users that are
I have a PHP script that runs as a CGI program and the HTTP

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.