Score:1

Apache .htaccess causing images to load extremely slowly

de flag

I am running a single page application that requires the following lines on my .htaccess . However, images on its /images/ folder are now loading extremely slowly.

Is there anything wrong with the following lines?

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.html [QSA,L]
Score:0
kz flag

This should not have a significant impact on the loading of images. However, it can be optimised to exclude the /images directory from being processed.

For example:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !^images/ index.html [L]

The QSA flag was not required.

OR, exclude all requests that look like they already have a file extension, which should naturally include all your images, JS, CSS and any other static resources. However, this does mean that your page URLs cannot contain what looks like a file extension.

For example:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.\w{2,4}$ index.html [L]
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.