I have two bundles in Symfony 2.2
1. FrontBundle on domaint.tld
- domain.tld/symfony/src/Comapny/FrontBundle/Resources/public/css
- domain.tld/symfony/src/Comapny/FrontBundle/Resources/public/images
- domain.tld/symfony/src/Comapny/FrontBundle/Resources/public/js
2. AdminBundle on admin.domain.tld
- domain.tld/symfony/src/Comapny/AdminBundle/Resources/public/css (custom.css)
- domain.tld/symfony/src/Comapny/AdminBundle/Resources/public/images (image.png)
- domain.tld/symfony/src/Comapny/AdminBundle/Resources/public/js
domain.tld/symfony/src/Comapny/AdminBundle/Resources/public/css/custom.css
div.image {
background-image: url(../images/image.png);
}
domain.tld/symfony/app/config/config.yml
debug: "%kernel.debug%"
use_controller: false
bundles: [ AdminBundle, FrontBundle ]
read_from: "%kernel.root_dir%/../../public_html/"
write_to: "%kernel.root_dir%/../../public_html/"
filters:
cssrewrite: ~
domain.tld/symfony/app/config/routing.yml
admin:
host: "admin.domaint.tld"
resource: "@AdminBundle/Controller/"
type: annotation
front:
host: "domain.tld"
resource: "@FrontBundle/Controller/"
type: annotation
domain.tld/symfony/src/Company/AdminBundle/Resources/views/layout.html.twig
{% stylesheets
'bundles/admin/css/custom.css'
filter='cssrewrite,?yui_css'
%}
<link rel="stylesheet" href="{{ asset_url }}"/>
{% endstylesheets %}
i use
app/console cache:clear
app/console assets:install ../public_html --symlink
app/console assetic:dump
--
PROBLEM
On domain.tld works everything OK, but problem is on subdomain.
source code from admin.domain.tld
<link rel="stylesheet" href="/css/8d488cd_custom_11.css"/>
8d488cd_custom_11.css
div.image {
background-image: url(../../bundles/admin/images/image.png);
}
from firebug
"NetworkError: 404 Not Found - http://admin.domain.tld/bundles/admin/images/image.png"
Any idea how to correct code or configuration to (css backgrounds) working for subdomain and root domain too ?