How to Protect the wp-content Folder of Your WordPress Website?

Step::1 Login to your cPanel account and open the File Manager under Files.

Step::2 Open the root directory/public_html

Search for wp-content, click to open

Step::3 The folder consists of many directories from which, you need to open the uploads folder.

The UPLOADS directory has all the media files of your WordPress website. You can see the arrangement after opening it.

Step::4 Here you have to create a new file, click on +File showing at the top-left corner of the main navigation menu of cPanel.

Step::5 A popup appears, which require you add the file name. Make sure you don’t forget the dot as a prefix of the .htaccess file.

You can see the path of your wp-content/uploads directory. For now, click on the Create New File button.

Step::6 Refresh the page, and you can see the .htaccess file. As always, you need to right-click to edit it.

A new tab appears to you. You can see an empty file because it’s just a text file, unlike the main .htaccess file, it doesn’t contain the rewrite rules.

Step::7 Add the code given below

# Kill PHP Execution
<Files ~ ".ph(?:p[345]?|t|tml)$">
deny from all
</Files>


Step::8 Click Save Changes button and close the file.

This code will stop PHP execution in wp-content/uploads directory.

Visit our Blog for more details. You can also watch the video here.

  • "Missing a Temporary Folder" Error, How to Fix the "Missing a Temporary Folder" Error of a WordPress, wordpress, wordpress tutorials, wordpress errors
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Fix WordPress error “There has been a critical error on your website”

Step::1 First of all login to your cPanel and go to File ManagerStep::2 Go inside public_html and...

How to Stay Logged in for a longer period in your WordPress?

Step::1 First of all you must know the theme which is currently activated in your website. So...

How to bulk delete spam comments in your WordPress website?

Step::1 Login to your cPanel and click on File Manager sectionStep::2 Go to public_html and then...

How to Change WordPress logo in wp-admin page?

Step::1 Login to your cPanel and go to File Manager sectionStep::2 Now go to Public_html Step::3...

How to Change WordPress Admin Username?

Step::1 Login to your WordPress dashboardStep::2 Now at the same time login to your WordPress...