Mobile app version of vmapp.org
Login or Join
Sent6035632

: Deny access to a folder on hosting server but serve the pages My hosting server allows to host multiple websites. The directory structure is like this root |_ www.a.com |_ www.b.com |_ www.c.com

@Sent6035632

Posted in: #Security #Webserver

My hosting server allows to host multiple websites.
The directory structure is like this


root
|_ a.com |_ b.com |_ c.com |_ d.com


I want to put some PHP files on the d.com folder so if some one browse the site from web-browser can get it, but no one can get it's source code [even by loggin in to the root folder].
Is there any way to doing so ?
There is a feature called Password protect folder or so, can in help in this case ?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Sent6035632

2 Comments

Sorted by latest first Latest Oldest Best

 

@Gretchen104

I suspect "Password protect folder" puts a password on for people using web browsers. I think the best way to achieve this is to have separate ftp logons for the directories for a.com, b.com and c.com. Then only you, with access to the root, have access to the files for d.com. You could make the passwords the same so that people only have to remember one password.

10% popularity Vote Up Vote Down


 

@Sarah324

PHP is executed on the server so if someone pulls up a PHP file in their browser the PHP will always execute and users will only ever see the output it creates. If you can see PHP code in your browser you either have a coding error or Apache is not set up properly.

If you want to make sure no one can see the files listed in these directories but still pull up the web pages, you can do that easily with .htaccess:

Options -Indexes

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme