Mollo
Mollo

Reputation: 723

How to share images between subdomains?

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:

background:url(../images/image.jpg);

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!

Upvotes: 1

Views: 415

Answers (1)

RichardB
RichardB

Reputation: 2767

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.

Upvotes: 3

Related Questions