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

  • Home
  • SEARCH
  • 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 6154541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:16:47+00:00 2026-05-23T20:16:47+00:00

I have a php websites hosted on a server. I use CPanel to manage

  • 0

I have a php websites hosted on a server. I use CPanel to manage it. public_html has lets say following directory structure

public_html
  - dir1
  - dir2
  - dir3
  - ....other files.....
  - website2home

Now I am trying to make website2home as the base directory of my website, but files inside website2home use some files from public_html folder and some files from within itself.

THE PROBLEM

When I assign a domain name to website2home, It does not reads the files from public_html folder (in fact, public_html folder is not visible) and shows some php warnings and some 404 not found errors. But lets say the domain name for original website is www.aaa.com, then if I access website2home by using www.aaa.com/website2home all works fine.

So My Question…

Is there any way to set the base directory, so that my website2home fetches all files and correct files without replacing hundreds of filepaths in php code?

Please answer considering that I don’t want to modify source files of website.

  • 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-05-23T20:16:47+00:00Added an answer on May 23, 2026 at 8:16 pm

    I believe you are looking for some kind of .htaccess configuration. For instance, you may set your website2home folder as base folder for your http://www.aaa.com domain and then redirect some file access to other folders using .htaccess, something like this..

    RewriteEngine on
    RewriteRule captcha.jpg ../captcha.jpg
    RewriteRule \.pdf$ ../pdf_files/$1
    

    Have a look to mod_rewrite documentation

    Edit: If, for some reason, the ../ redirection doesn’t work, you always can redirect all your files to a pseudo-index PHP page. For instance:

    RewriteEngine on
    RewriteRule captcha.jpg my_index.php?access=../captcha.jpg
    RewriteRule \.pdf$ my_index.php?access=../pdf_files/$1
    

    And then, in your index PHP page you can simply load your PHP files in other folder:

    require "../pdf_files/$requested";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two websites that will share some resources, lets say, index.php, functions.js and
I used to have PHP websites and using url rewriting on picture to have
Can you create websites with Chinese characters in PHP? UPDATE: Perhaps I should have
I have a series of web sites all hosted on the same server with
I have a simple website built using PHP. It is hosted on a Linux
I have a 3rd party server which has a classic ASP page which takes
This question is server oriented. I have a hosted server (a rather small one,
I have developed simple websites and hosted them on shared networks, mainly godaddy. So,
I have a site developed in ASP.NET and hosted on a windows server using
I have a linux hosted website, i am trying to use the below code

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.