How to share images between subdomains?

Tags: php,css,css3,subdomains

Problem :

I have a domain, lets call it 'oficial' and a subdomain.

This subdomain is a copy from oficial in design terms speaking (CSS, images, etc)

My problem is how to use all the images and styles from oficial domain ?

I tried to include CSS files into subdomain like this include(/var/www/oficial/styles/style.css); It worked but all the classes with background-image property didn't work because they are declared like this:


so, it is trying to reach images folder into the subdomain directory, and there is the real problem.

I thought to put full URL instead, but I would have to modify all CSS files with background-image property

Is there any other way to achieve this ?

Thanks in advance!

Solution :

Don't load the stylesheet inline.

You can link to style sheets externally like this:

<link rel="stylesheet" type="text/css" href="http://www.mystyle.css">

That way, the background images will be relative to where the stylesheet is hosted and not the page where it is embedded.

    CSS Howto..

    I have 3 divs in one row, how do I get the middle div to stay an exact width while the left and right div shrink in as the screen resizes smaller?

    How can I remove vertical padding from ionic icon?

    How do I vertically and horizontally center all these elements?

    How do I make my css class footer go from the left to right side of the screen?

    Style elements based on how many elements there are using just CSS?

    How do I make a certain text style larger?

    how to arrange divs with css as a grid?

    How can I move text to the left with CSS?

    Button Built in CSS showing different font color in FF and Webkit

    How to float 3 divs with margin left & right 0px?

    How to modify wordpress plugin css [closed]

    How to disable IE11 WebBrowser control scaling

    How to scale image block using only css?

    How can I find the CSS3 rotation of an element?

    CSS - How to remove whitespace between anchored images

    How to create a css file in eclipse with e(fx)clipse plug in

    How do I get the Twitter Widget to act as if any other element?

    How to make the background color transparent

    How to make float : left work same as table-cell?

    How to position elements with flex [duplicate]

    How to get html elements from different class xpath?

    How to change css position left to right using jquery?

    Sencha Touch 2 date picker component & css: how to display hidden column names?

    How to use @page CSS in ASP.NET MVC View

    How to make a div with a circular shape? [duplicate]

    Javascript slideshow that gradually zooms on image [closed]

    How to add or create an illusion of movement to a fixed div?

    Different JEditorPanes show html content, using the same css rules

    Using CSS3 how to animate the multiple `background-image` for different view ports

    How can I get a button on the side of a text box to be perfectly aligned all the time?