Psycoder Posted November 4, 2006 Share Posted November 4, 2006 Earlier this week I tried a few things out on my website (which is still in development, and still local). I used an .htaccess to redirect all incoming requests (that were not images and the like) through a certain file (which eventually included the site from out of the public folder). When I started my computer up the day after, the local website gave an 403 forbidden error. This was because he suddenly did no longer see my file (I used to redirect all incoming requests to another file in .htaccess). After a few tests, I found out my website did not use any of the commands in the .htaccess file. I am guessing something in the apache configuration file must be able to trigger .htaccess again, however I can't remember changing that file lately.This website is set up as a virtual host, so here is the code of the virtual host:[code]<VirtualHost *:80> ServerName www.example.com ServerAdmin admin@localhost DocumentRoot path/to/website/public AllowOverride All</VirtualHost>[/code].htaccess:[code]Order deny,allowDeny from allAllow from localhostOptions -IndexesRewriteEngine onRewriteRule !\.(gif|jpg|png|css|js)$ parserfile.bla[/code]parserfile.bla includes a different file from outside the public folder (ie ../secretfolder/index.php)Beyond renaming some paths and such, this is the information from those files.Now I mainly wonder what exactly can keep apache from using that .htaccess? Something must have changed to restrict use for it.My second question is more of an optimisation question. Is there a way to let .htaccess redirect everything to another file outside the public folder? "RewriteRule !\.(gif|jpg|png|css|js)$ ../secretfolder/index.php" seems not to work.But the main question remains, what can keep apache from using .htaccess files? Quote Link to comment Share on other sites More sharing options...
Psycoder Posted November 10, 2006 Author Share Posted November 10, 2006 This weekend, now I had time to work on this again, I finally found out what stupid mistake I had made. in the .htaccess file was written:[code]Order deny,allowDeny from allAllow from localhost[/code]This used to work on my first set up of this website long ago, however I changed a few things since then. I no longer use it under localhost (One project had split up in two, as to effectively devide the problem in smaller portions). Now that it has moved, and I myself do not use localhost anymore, I had to change it to [code]Allow from 127.0.0.1[/code]It's always the small things that are overlooked :P Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.