Would you like to learn how to install Apache and deny direct access to images? In this tutorial, we are going to configure the Apache server to block direct access to images on your website.
• Ubuntu 20
• Ubuntu 19
• Ubuntu 18
• Apache 2.4.41
In our example, the Apache server is hosting the website WWW.GAMEKING.TIPS.
Copyright © 2018-2021 by Techexpert.tips.
All rights reserved. No part of this publication may be reproduced, distributed, or transmitted in any form or by any means without the prior written permission of the publisher.
Equipment list
The following section presents the list of equipment used to create this tutorial.
As an Amazon Associate, I earn from qualifying purchases.
Apache – Related Tutorial:
On this page, we offer quick access to a list of tutorials related to Apache.
Tutorial Apache – Blocking direct access to images
Install the Apache server.
Edit the Apache configuration file for the default website.
Add the following lines to this configuration file.
Change this line to your domain name.
Here is the file, before our configuration.
Here is the file, after our configuration.
Restart the Apache service.
In our example, the Apache server will forbid direct access to images on our website.
From a remote Linux computer, try to perform direct access to an image.
Here is the command output.
From a remote computer, open the browser and try to perform direct access to an image.
In our example, the following URL was entered in the Browser:
• http://www.gameking.tips/test1.jpg
The Apache server will deny access and display an error message.
Try to access the website URL and all images will be displayed.
Congratulation! You configured the Apache server to block direct access to images.