Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:09:11+00:00 2026-05-26T23:09:11+00:00

I’ve seen a few posts here about issues with relative image paths in CSS

  • 0

I’ve seen a few posts here about issues with relative image paths in CSS not working when the CSS is hosted in a CDN, but I have a situation I can’t find an answer for. In our Magneto store we have the Merge CSS feature turned on. Unfortunately, in Magento, when you do this, it merges them to a single file in the media folder instead of the skin folder. So now, relative paths for images don’t work. Magento tries the secure URL when it can’t find a resourse in the non-secure URL. In our case, we don’t use the CDN for secure pages, so it is able to find the images using the secure URL instead. This technically works, but our site is slower at returning the images than the CDN is and I’d really like to fix this. Short of going through all the CSS sprites and either hard-coding the CDN URL as the image path (undesirable) or removing the CSS directives all together and putting calls to getSkinUrl() within the template files that contain the offending elements (slightly less undesirable), I’m at a loss as to how to fix this. Surely someone has run into this problem before. Any suggestions or thoughts on how to work around this issue?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:09:11+00:00Added an answer on May 26, 2026 at 11:09 pm

    The actual problem has nothing to do with CDN or the location of the merged CSS files in relation to the images. Magento actually does something cool…it parses the CSS files and fills in all the relative URLs with full URLs. It does this inside the Mage_Core_Model_Design_Package class in the _prepareUrl method. It determines whether to use a secure URL or a non-secure URL in the following line:

    $secure = $store->isAdmin() ? $store->isAdminUrlSecure() : $store->isFrontUrlSecure();
    

    The problem here is that it will use a secure URL even if the page in question isn’t actually secure. If you have use secure URL in frontend enabled, it doesn’t use secure URLs all the time. It only uses them on the customer account pages and cart/checkout. Any other page is not secure and doesn’t need secure resources.

    When merging the URLs, Magento is smart in that it creates a css and a css_secure folder under the media folder. You’ll notice if you view the source of the customer account page that it is pulling the CSS from the css_secure folder, but on the homepage it uses the css folder. So it’s already set up to know the difference between secure and non-secure pages, but the merging of the CSS doesn’t take that into account.

    To fix this, I made a basic extension to rewrite the core/design_package model with a new _prepareUrl method. The only difference is that right after the line mentioned above I added this:

    $secure = $secure && Mage::app()->getRequest()->isSecure();
    

    This ensures that only the merged css files in the css_secure folder get secure URLs for the resources.

    Hope this helps anyone with a similar problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am reading a book about Javascript and jQuery and using one of the
I need a function that will clean a strings' special characters. I do NOT
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a bunch of posts stored in text files formatted in yaml/textile (from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.