How to put inclue file outside of htdocs?

I want files outside of htdocs it’s easier to include with subdomains

Error Message

If i try "inclue $_SERVER[“DOCUMENT_ROOT]./…/includes/main.php” Always 500.

Not possible on free hosting. Upgrade to premium hosting if you need that


So like that, means it seems impossible on free hosting?, I want it to be easy to include and safe from the user.

It’s possible - only that folder is inside htdocs

Read here the part that mentions includes


You can use .htaccess rules to block direct access to certain files or folders, or add a snippet of PHP code to every file that will block direct access.

On free hosting, all websites are restricted to their own htdocs directories. This way, you can be sure that if one website on the account gets hacked, all other domains on the account are safe.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.