0

I've found this old answer, which must fix the rewrite ability for assets. However, it doesn't work for Symfony 2.4. And by doesn't work, I mean that assets aren't being rewritten and bundle paths are still broken.

I've tried playing with rewrite rules manually with no luck so far. I simply can't get why this correct rule

# Fix the bundles folder
RewriteRule ^bundles/(.*)$ /web/bundles/$1  [QSA,L]

doesn't internally redirect all requests to /web/bundles? Anything else, including routes work correctly. So what causes this rewrite rule to fail?

Community
  • 1
  • 1
Yang
  • 8,580
  • 8
  • 33
  • 58
  • Is your vhost configuration pointing to the ``web`` or parent of ``web`` directory? – eRIZ Aug 27 '15 at 08:46
  • @eRIZ Can't access vhost since I'm using shared hosting. That must be done in `.htaccess` And that `.htaccess` located in the parent directory of `web` (i.e root) – Yang Aug 27 '15 at 09:23
  • Okay, so what's the result of pointing a browser at ``/web/bundles/testbundle/(...)``? httpd error or Symfony route error? – eRIZ Aug 27 '15 at 11:08
  • @eRIZ When pointing, for example, to `/web/bundles/framework/css/structure.css` it works displaying content of `structure.css`. What I'm trying to rewrite, is when pointing to `/bundles/framework/css/structure.css` it would fetch contents from `/web/bundles/framework/css/structure.css`, so I find it quite strange that `RewriteRule ^bundles/(.*)$ /web/bundles/$1 [QSA,L]` doesn't work as expected – Yang Aug 27 '15 at 11:41
  • Try dumping your assets using assetic dump command. This will help you out. – user3227262 Aug 27 '15 at 12:53
  • But you've not specified what error you see. – eRIZ Aug 27 '15 at 14:29
  • 404 from Symfony or httpd? – eRIZ Aug 27 '15 at 20:39

0 Answers0