2

Symfony 2.2 に 2 つのバンドルがあります

1. domaint.tld の FrontBundle

  • domain.tld/symfony/src/Company/FrontBundle/Resources/public/css
  • domain.tld/symfony/src/Company/FrontBundle/Resources/public/images
  • domain.tld/symfony/src/Company/FrontBundle/Resources/public/js

2. admin.domain.tld の AdminBundle

  • domain.tld/symfony/src/Company/AdminBundle/Resources/public/css (custom.css)
  • domain.tld/symfony/src/Company/AdminBundle/Resources/public/images (image.png)
  • domain.tld/symfony/src/Company/AdminBundle/Resources/public/js

domain.tld/symfony/src/Company/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 %}

私が使う

app/console cache:clear
app/console assets:install ../public_html --symlink   
app/console assetic:dump

--

問題

domain.tld ではすべて問題なく動作しますが、問題はサブドメインにあります。

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);
}

火炎虫から

"NetworkError: 404 Not Found - http://admin.domain.tld/bundles/admin/images/image.png"

サブドメインとルートドメインでも機能するコードまたは構成を (css 背景) に修正する方法はありますか?

4

0 に答える 0