I've recently moved over to using the Symfony2 PHP framework, and wanted to include all of the awesomeness of the html5boilerplate from the outset, however having a few problems with merging the .htaccess files for both.
The top three are from boilerplate; redirecting from www.example.com to example.com, example.com/test to example.com/test/, and restricting access to any folders prepended with a . (.git, for example).
The final is Symfony2's rewrite for the front end controller. I'd like this to be accessed if no other redirects happen (so example.com/hello/ should reach it).
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
RewriteRule ^(.*)$ /$1/ [R=301,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteRule "(^|/)\." - [F]
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
If the last rewrite is commented, Apache returns a 400 Bad Request, and I'm not quite sure why.. The redirect are set to external (R=301) so it should re-evaluate, and get to the app.php one.
Rewrite is already set to on as well.
Any suggestions would be great, not much of a rewrite buff =(