Restrict PHP File Execution via htaccess

Hi guys, trying to come up with a better security using the htaccess file, but adding this code gives an 500 error: https://travelcrestedbutte.com

# Restrict PHP File Execution
<Directory "/var/www/wp-content/uploads/">
<Files "*.php">
Order Deny,Allow
Deny from All
</Files>
</Directory>

Do you know, if there is a way around it?

Hi There,

Thank you for writing in, did you added that to the root .htaccess file? You meant to create a new .htaccess file and upload it to the directory you want to restrict.

If this does not work, please contact your hosting, they might have a better solution as this is a server-side aspect.

Cheers!

1 Like

You guys are great, thanks so much for the clarification!

You’re welcome! :slight_smile:

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