400 Bad Request with Symfony2 and html5boilerplate redirect rules

I recently switched to using the Symfony2 PHP framework and wanted to include all the awesomeness of html5boilerplate from the very beginning, however I had some problems with merging .htaccess files for both.

Top three - from the template; redirection from www.example.com to example.com, example.com/test to example.com/test/ and restricting access to any folders added using. (.git, for example).

The final is a rewrite of Symfony2 for the front panel controller. I would like it to be available if there were no other redirects (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>

, Apache 400 Bad Request, , .. (R = 301), .php one.

.

, rewrite buff = (

+3
2

Symfony2.

app_dev.php app.php, .

?

+2

100%, /, ...

<IfModule mod_rewrite.c>
  RewriteEngine on

  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/|#(.*))$
  RewriteRule ^(.*)$ /$1/ [R=301,L]

  RewriteRule "(^|/)\." - [F]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
+1

All Articles