Do browsers cache the . htaccess file?

Asked

Viewed 69 times

1

I wrote a regular expression to make the site always redirect to the HTTPS protocol. However, it is not possible to use HTTPS in localhost. To gain access, I turned the lines responsible for the redirect into comments and, before finally putting the edits on the air, undo those changes in the . htaccess for redirecting to be done.

My question is: does the browser cache the . htaccess file? Because when I turned the lines into comments and updated the page, I kept redirecting to HTTPS, and when I disabled the cache through Chrome Devtools, the redirect was no longer done.

  • already stopped to think that the cache is made in your browser ?

1 answer

3

Not the browser nor has access to this file, it is a way to configure Apache on your server, what happens is that the browser makes a request to your server, for example:

GET http://dominio.com

And stores the answer in cache, when a second request is made equal the browser does not even complete the request, instead it already returns with what is cached, ie changes in the file .htaccess on the server were not even "used" (no new request was made, the cache was used), the browser does not even know there was a change, and uses the old version

When you clear the cache, the browser erases that response from GET http://..., then the next request is not interrupted and actually reaches the server that responds with a new content, in your case the redirect

Browser other questions tagged

You are not signed in. Login or sign up in order to post.