Yesterday i spent many hours trying to fix a 302 loop with Pligg (a great piece of open source software to create a Digg clone site), so i’m gonna post here the (easy) solution, just in case someone else have same problem.
Installed Pligg and enabled search engine friendly URL (Pligg calls it URL Method 2), i had a loop of 302 redirects when i tried to visit users page.
Apache’s error log file said “Negotiation: discovered file(s) matching request: /path/to/vhost/domain.tld/htdocs/index.html (None could be negotiated).” and it should had tell me something, but i haven’t be able to look for the solution in the right place (Google is not always the best place…).
Apache’s access log file showed a bunch of 302 redirects. So, the problem was a loop of 302 redirects (and page wasn’t loaded, of course).
Where the problem was? I immediately thought to look in .htaccess file, but after i commented every single rewrite instruction i still had the problem. Then, i looked at Apache’s configuration to remember how virtual host are configured (i use VHCS on the server i installed Pligg).
At that point, something catched my eyes. In fact, vhosts have this line:
Options Indexes Includes FollowSymLinks MultiViews
In .htaccess file i had the line:
Options +Indexes +FollowSymlinks
So, looking for explanation of every option in Apache documentation, i found out that MultiViews was the option giving problems to me (more info here).
And adding -MultiViews to the line above fixed the problem. So, just change
Options +Indexes +FollowSymlinks
to
Options +Indexes +FollowSymlinks -MultiViews
if you have the same problem of 302 redirects loop.
I spent many hours to find it out, so i hope this post can save your time in case you have the same problem.
Leave a Reply