css - Problems with image path -


i have project built in codeigniter. in localhost, website work fine, in remote server, fail image inclusion css & js.

the site, guest in subdomain. server file system hierarchy is:

--/ ---apps (subdomain folder app) ----application ----[other ci forlders] ----css ----js ----img --[other web folders (no ci)] --index.html 

in css files define images paths way: "../img/" example:

#maincontainer {background-image: url('../img/main_bg.gif');} 

but, in chrome , ff, show error load resources:

failed load resource: server responded status of 404 (not found) http://apps.manantiales.edu.ar/img/main_bg.gif

any ideas?

you on subdomain, therefore, correct path be:

http://manantiales.edu.ar/apps/img/main_bg.gif

  1. you can use rules in htaccess file make subdomain path work or
  2. just use absolute paths diecho suggested. can embed php code in css files this:

    maincontainer {background-image: url('< ?php echo site_url('img/main_bg.gif');?>');}

(i have put extraspace @ < ?php not sure how format show correctly here)


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -