Resolving Hosting Configuration Issue and Accessing Folders Outside the Root Directory - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Sunday, June 18, 2023

Resolving Hosting Configuration Issue and Accessing Folders Outside the Root Directory

I need a suggestion on how to solve this issue or a suggestion on where to host my website. I tried hosting it on a local provider and had a configuration problem as the provider does not allow access to a folder that is outside the root directory. In my case, the root directory is 'public', but I have, for example, frameworks installed by Composer in a 'vendor' folder that is at the same level as 'public', and I can't access the files within because in the requests that are made, the server replaces the folder paths up to 'vendor' with the site's URL, like this: 'https://ift.tt/cEimAXk'. Since 'vendor' is not in the public folder, I can't access the files that are requested via script in this way: In the config.php file, I define the 'Doc_root' path like this: define('ROOT_FOLDER', 'public'); $this_folder = substr(__DIR__, strlen($_SERVER['DOCUMENT_ROOT'])); $parent_folder = dirname($this_folder); define("DOC_ROOT", $parent_folder . DIRECTORY_SEPARATOR . ROOT_FOLDER . DIRECTORY_SEPARATOR); and I request the files on the HTML pages like this:

Any suggestions on how to resolve this?



source https://stackoverflow.com/questions/76497343/resolving-hosting-configuration-issue-and-accessing-folders-outside-the-root-dir

No comments:

Post a Comment