Would you like to learn how to redirect image hotlinking on the IIS server? In this tutorial, we are going to configure the IIS server to redirect image hotlinking on your website.

• Windows 2012 R2
• Windows 2016
• Windows 2019

In our example, the IIS server is hosting the website WWW.GAMEKING.TIPS.

Equipment list

The following section presents the list of equipment used to create this tutorial.

As an Amazon Associate, I earn from qualifying purchases.

Tutorial IIS - Rewrite image hotlinking

Access the URL REWRITE website and download the installation package.

IIS URL REWRITE DOWNLOAD

Perform the URL REWRITE installation.

URL REWRITE INSTALLATION

Start the application named: IIS Manager.

Start IIS Windows

On the IIS Manager application, select your website.

On the right part of the screen, access the option named: URL Rewrite.

IIS - URL REWRITE - WEBSITE

On the top right part of the screen, click on the Add Rule option.

IIS URL REWRITE - ADD

On the inbound rules, create a new blank rule.

URL REWRITE BLANK RULE

To detect image hotlinking, use the following configuration:

Copy to Clipboard

Change the Pattern option to the desired image extensions.

Here is our configuration.

IIS - prevent Hotlinking

On the Conditions area, click on the Add button and use the following configuration:

Copy to Clipboard

Change the Pattern option to your website.

Click on the OK button.

IIS - Hotlinking prevention

On the Action area, perform the following configuration.

Copy to Clipboard

On the top-right part of the screen, click on the Apply option

Create a replacement image to be delivered.

IIS Hotlinking - Image replacement

In our example, the IIS server will rewrite the hotlinking to images on our website to a local image.

If someone tries to hotlink your images, the image request will be rewritten.

IIS hotlink image rewrite

Congratulation! You configured the IIS server to rewrite image hotlinking to another local image.

Tutorial IIS - Redirect image hotlinking

Access the URL REWRITE website and download the installation package.

IIS URL REWRITE DOWNLOAD

Perform the URL REWRITE installation.

URL REWRITE INSTALLATION

Start the application named: IIS Manager.

Start IIS Windows

On the IIS Manager application, select your website.

On the right part of the screen, access the option named: URL Rewrite.

IIS - URL REWRITE - WEBSITE

On the top right part of the screen, click on the Add Rule option.

IIS URL REWRITE - ADD

On the inbound rules, create a new blank rule.

URL REWRITE BLANK RULE

To detect image hotlinking, use the following configuration:

Copy to Clipboard

Change the Pattern option to the desired image extensions.

Here is our configuration.

IIS - prevent Hotlinking

On the Conditions area, click on the Add button and use the following configuration:

Copy to Clipboard

Change the Pattern option to your website.

Click on the OK button.

IIS - Hotlinking prevention

On the Action area, perform the following configuration.

Copy to Clipboard

On the top-right part of the screen, click on the Apply option

IIS - Redirect hotlinking image

In our example, the IIS server will redirect image hotlinking on our website.

If someone tries to hotlink your images, the image request will be redirected.

IIs - Redirect image hotlinking 302 code

From a remote Linux computer, try to perform hotlinking to an image.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

The IIS server will redirect hotlinking to images on our website.

Congratulation! You configured the IIS server to redirect image hotlinking.