How to block a specific image using .htaccess?

Member

by darion , in category: Third Party Scripts , 8 months ago

How to block a specific image using .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by denis , 8 months ago

@darion 

To block a specific image using .htaccess, you can use the following code in your .htaccess file:

1
2
3
4
<Files "image.jpg">
    Order allow,deny
    Deny from all
</Files>


In this code snippet, "image.jpg" should be replaced with the name of the specific image file you want to block. This code will deny access to that particular image file and return a 403 Forbidden error when someone tries to access it.


After adding the code to your .htaccess file, make sure to save the changes and upload it to your web server for the block to take effect.

Related Threads:

How to block a url using .htaccess?
How to hide original image path using .htaccess?
How to block unwanted hosts in .htaccess?
How to block folder access to ftp with .htaccess?
How to block access to the home page of the website in .htaccess?
How to block a certain type of urls on robots.txt or .htaccess?