Jump to content

htaccess allow files included only with PHP


Mudsaf

Recommended Posts

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

<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

  • 4 weeks later...

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 by chasethemetal
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...