2

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 ?

j0k
  • 22,600
  • 28
  • 79
  • 90
patie
  • 1,074
  • 1
  • 10
  • 18
  • You want to access the same resource files from `admin.domain.com` and `domain.com`? – cheesemacfly Feb 05 '13 at 16:12
  • @cheesemacfly no, each bundle has own resources (each has own template) – patie Feb 05 '13 at 16:14
  • Do you have the expected files/symlink under `web/bundles/admin` on your server? – cheesemacfly Feb 05 '13 at 16:24
  • im developing on localhost, but thats not essence. yes symlink works. css are corectly loaded (because assetic:dump create css and js). all is in public_html root – patie Feb 05 '13 at 16:30
  • So you are saying that the file `web/bundles/admin/images/image.png` exists but when you try to reach it with `http://admin.domain.tld/bundles/admin/images/image.png` you get a 404? – cheesemacfly Feb 05 '13 at 17:03
  • yes exist on server in `/public_html/bundles/admin/images/image.png` so its working with `http://domain.tld/bundles/admin/images/image.png` but not for `http://admin.domain.tld/bundles/admin/images/image.png` - yes its logical - but how solve this ? :) – patie Feb 05 '13 at 17:11
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/23984/discussion-between-patie-and-cheesemacfly) – patie Feb 05 '13 at 17:16

0 Answers0