Why your .htaccess rule doesn’t work on SiteGround hosting?

Ronald Aug
1 min readDec 11, 2022

I was stuck for a day setting up the .htaccess file on Siteground hosting.
In fact, SiteGround serves the static asset files on top of Nginx to make the website faster. However, one of my .htaccess rules is to protect media files from direct access and it no longer trigger due to NGINX DIRECT DELIVERY.

This is a warning message from SiteGround.

With NGINX Direct Delivery we will serve most of the static resources of your website (images, JS, CSS and others) directly through NGINX to achieve the fastest possible loading time. It works for all kind of applications without additional customisation.

For best results we highly recommend having NGINX Direct Delivery enabled at all times. However, if you need to use custom caching .htaccess rules for your static content you may need to switch it off.

To make my .htaccess rule work as expect, I had to turn off NGINX Direct Delivery option under the speed > caching of SiteGround’s setting.

Make sure to flush the dynamic cache before testing the rule again.

Just sharing the issue and solution what I encountered today. Thanks for reading.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Ronald Aug
Ronald Aug

Written by Ronald Aug

I'm a coffee-loving, music-obsessed programmer, founder of August Host. I live in Taunggyi, Myanmar with my lovely wife and our kid, Mo Mo.

Responses (3)

Write a response