But the problem is: There a File names "includes" which includes the php files which have been included in some of the php files outside of it. But I want to lock/ make it inaccessible for users. Is it possible that the users can't access the folder/directory but the php files can? Well, Now I am testing my website on XAMPP, but I have plans to shift it to a web server. So, please answer so that I can my website more secure.

Thanks in Advance! :)

Recommended Answers

All 3 Replies

You can use .htaccess:

order deny,allow
deny from all

put this file inside the folder to protect and no one can access from the web. Source: http://httpd.apache.org/docs/2.2/howto/access.html

bye :)

Yeah It works, but the main page and other pages which include the files inside the blocked directory/folder are unable to access them. The Files can't Access CSS, PHP Files can't access the header.php and footer.php files ( they are inside the blocked directory ) Plz Help!

Explain better which files you want to limit access. Because CSS files can't be stored on that kind of directory.

And post a portion of code where you include the header.php that doesn't now work. So we can see what is happening. To include a file from that directory you should write something like this:


where the path is the server root, not an url. Bye :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.