My fresh install of fuel was showing me the welcome view just fine, but was not correctly routing any other request, whether in the routes file or a straight controller access; I was getting a 500 error from my server.
It turns out the .htaccess rewrite in /public (which is my document root) was putting me in a redirect loop! The error in my apache error log reads:
[client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error.
As I assume I'm not the only one who will ever have this problem, I thought I'd come by here and post the solution I found to the problem:
The rewriting section in the .htaccess file looks like this:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
For some reason, this was sending me into a redirect loop, until I changed the last line above to this:
RewriteRule ^(.*)$ /index.php/$1 [L]
Notice that the difference is the absolute path (/) to index.php rather than the relative path. This one simple change totally fixed my problem, and now I don't have any more routing issues.
I'm sure someone much smarter than me can explain why this stopped my redirect loop. But if you're having this problem, give this solution a try.
I am having the same problem, but non-default routes are working on my development environment(Wamp server), only when i upload my project to Linux hosting account, I get Internal server error 500 on non-default routes. Applying your fix solved the problem(Thanks for that). But it is strange that default routes work and user defined routes through up error. Some one should look into the problem. I will post it on dev.fuelphp.com.
Thanks
Raffi
I ran into this problem while configuring some dynamic vhosts.
Another solution is to add "RewriteBase /" to the .htaccess file.
So the complete file would look something like this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I hope this helps others running into this problem!
Clearly not a FuelPHP issue.
Anyone have an explanation for this? If we know what causes it, perhaps it's a good idea to change the default .htaccess in the repository to include the RewriteBase.
It doesn't seem to have any impact on a default installation. So what is the difference between your virtual host definitions and mine?