Mudsaf Posted March 8, 2013 Share Posted March 8, 2013 Hey, im wondering is it possible to prevent user to go straight to example scripts/php/myscript1.php, but allowed to include with php. <?php// Example index.phpinclude 'scripts/php/myscript1.php';?> Link to comment Share on other sites More sharing options...
jeffman Posted March 8, 2013 Share Posted March 8, 2013 You can use .htaccess to deny http access to a whole directory. PHP would still have system access, such as include. Link to comment Share on other sites More sharing options...
Mudsaf Posted March 8, 2013 Author Share Posted March 8, 2013 <Directory myfolder1/myfolder/>order allow,denydeny from all<Directory> This gave my whole website 500 internal server error. I would like it on every php file on that folder except one. Example myfile.php should be accessed. Link to comment Share on other sites More sharing options...
chasethemetal Posted March 31, 2013 Share Posted March 31, 2013 (edited) Move those files behind the public directory. Not sure what your folder name is but, it looks like public_html/scripts/php/myscript1.php right now. So make a folder next to public_html called scripts/ now your include will be include '../scripts/php/myscript1.php'. No need for any .htaccess, plus the .htaccess file still exposes your directory structure. Solution, move all PHP behind the public wall making it impossible to access from the browser directly /home/user/public_html/ *all website, html, js, css, images*/home/user/scripts/ *php and such here* Edited March 31, 2013 by chasethemetal Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now