Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mod_rewrite - Does Apache caches .htaccess rules? (still follow rules even after deleting the .htaccess file)

I was doing some tests with mod_rewrite in my wamp environment.

I tested a simple rule that I put at the root of one of my websites and asked it to redirect any request ending with index.php to localhost (there is no sense to it, just wanted to check the rule)

It worked, but after, any change I'd made to my .htaccess file rule was not reflected. After a while I just decided to delete the .htaccess... well it's still doing redirection! I just don't understand it. Does Apache cache the rules or something (restarting services trough wamp menu didn't change anything)

(Don't ask for the exact rule I used, since I deleted the file, I don't think it's relevant anyway)

like image 360
Kev Avatar asked Apr 26 '12 20:04

Kev


People also ask

How long does it take for htaccess to change effect?

htaccess files follow the same syntax as the main configuration files. Since . htaccess files are read on every request, changes made in these files take immediate effect.

Does Apache cache htaccess?

To answser the topic (not the question): No, . htaccess files are not cached by Apache.

Are htaccess changes immediate?

htaccess files are read on every request. Therefore, any changes to these files result in immediate effect, unlike the global settings, which require the server to be restarted.


1 Answers

.htaccess files are processed each time a request comes through. It is possible that your browser cached the request being forwarded. Did you try it with httpfox or anything to see what the headers said?

like image 152
gpojd Avatar answered Sep 19 '22 21:09

gpojd