ExpiresActive On' and 'ExpiresDefault "access"' in .htaccess make site disappear in WAMP

ExpiresActive On' and 'ExpiresDefault "access"' in .htaccess make site disappear in WAMP - .htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, wampserver, , , .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :


I'm working on a site locally within a folder with WAMP. When I add the following to my .htaccess file the folder is no longer viewable in WAMP.



ExpiresActive On



ExpiresDefault "access"



I'm working on a cache manifest demo and the code is to prevent files being cached, I've no idea why it would make the folder disappear.


Solution :

I suspect a different approach will work better (I haven't actually tested this though:-). Try in your .htaccess something like



ExpiresActive Off



Header set Cache-Control "no-cache, proxy-revalidate, no-transform"



Header set Pragma "no-cache"



(No blank lines needed in .htaccess, but if I leave them out here "line wrap" thinks it's just a funky paragraph and runs everything together.)



What you've got now specifies that the pages ARE cacheable, but the cache time is 0, so all pages are always out of date. This arguably doesn't make a whole lot of sense, and who knows which piece of software is doing some "error recovery" that results in the directory not being visible. I suspect something is stuck in a loop requesting the same page over and over trying to get a copy that isn't already expired, and the failsafe for too many loops goes off and the browser just throws up its hands and makes the whole folder invisible.



It's sometimes true that "xxx but 0" is the same as "no-xxx" ...but not in this case. Saying to an Apache server "cacheable but 0" is NOT quite the same as saying "not cacheable" ...close but not the same, and possibly handled weirdly by some software.



Actually I think it is something different. When I tried to load a site with ExpiresActive On in the .htaccess file my site also does not load. In the apache error.log it says the following:



Invalid command 'ExpiresActive', perhaps misspelled or defined by a module not included in the server configuration


After enabling Expires Module through WAMP system tray it works!


Additionally, if you would like to do some further testing, give the htaccess tester tool a try. It allows you to specify a certain URL as well as the rules you would like to include and then shows which rules were tested, which ones met the criteria, and which ones were executed.

Comments

Popular posts from this blog

Rewrite in Mediawiki, remove index.php, .htaccess

.htaccess rewrite wildcard folder paths from host

Using .htaccess to set a cookie and 301 redirect