.htaccess - Symfony2 assetic cssrewrite with mod_rewrite on app.php giving incorrect basepath -
when using cssrewrite getting incorrect paths. works fine when using app_dev.php or app.php in url, example, mysite.com/site/app.php/login
correctly function. however, using mysite.com/site/login
not work.
when viewing css files see following while accessing mysite.com/site/app.php/login
:
src: url('../../bundles/acmetest/font/fontawesome-webfont.eot?#iefix&v=3.2.1')
the correct path when viewing mysite.com/site/login should be:
src: url('../bundles/acmetest/font/fontawesome-webfont.eot?#iefix&v=3.2.1')
here htaccess file:
directoryindex app.php <ifmodule mod_rewrite.c> rewriteengine on rewritecond %{request_uri}::$1 ^(/.+)/(.*)::\2$ rewriterule ^(.*) - [e=base:%1] rewritecond %{env:redirect_status} ^$ rewriterule ^app\.php(/(.*)|$) %{env:base}/$2 [r=301,l] rewritecond %{request_filename} -f rewriterule .? - [l] rewriterule .? %{env:base}/app.php [l] </ifmodule> <ifmodule !mod_rewrite.c> <ifmodule mod_alias.c> redirectmatch 302 ^/$ /app.php/ </ifmodule> </ifmodule>
is there way configure production environment know path /
, not app.php/
correctly configures cssrewrite paths?
here twig configuration assetic:
{% block stylesheets %} {% stylesheets 'bundles/acmetest/css/bootstrap.min.css' 'bundles/acmetest/css/jquery-ui-1.10.3.custom.min.css' 'bundles/acmetest/css/jquery.iphone.toggle.css' 'bundles/acmetest/css/font-awesome.css' 'bundles/acmetest/css/glyphicons.css' 'bundles/acmetest/css/halflings.css' 'bundles/acmetest/css/retina.min.css' 'bundles/acmetest/css/style.css' filter='cssrewrite' %} <link rel="stylesheet" href="{{ asset_url }}" /> {% endstylesheets %} {% endblock %}
before proceed - read this answer ...
there 2 possible causes come mind right now.
at first - cssrewrite filter not work @bundle
-syntax. (documentation reference)
you have include stylesheets in twig template:
{% stylesheets 'bundles/my/css/style.css' filter='cssrewrite' %} <link rel="stylesheet" type="text/css" href="{{ asset_url }}" /> {% endstylesheets %}
further in order dump assets production use ...
app/console assetic:dump --env=prod
... make sure being dumped right environment settings. ( reference )
Comments
Post a Comment