Extension, Plugin

Archived
Forum
(read-only)

Minimee

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From John D. Wells

     

Relative cache URLs?

Support Request

JamesB
JamesB

Hello-
Is there a way to have the cached output url be relative regardless of what the sources are? I have a site where the templates could be used for both http and https pages.

Thanks!
James

John D Wells
# 1
Developer
John D Wells

Hi James,

For your situation there is the “protocol-relative” URL technique that Minimee supports. There is a caveat to the technique (to do with IE of course!), but it is widely considered the best way to ensure media is always being served over the correct protocol (if you use the HTML5 Boilerplate you may already recognise it):

http://www.paulirish.com/2010/the-protocol-relative-url/

To get this working, when you configure Minimee set the Base URL to omit the “http:” from the beginning, e.g.:

//yourdomain.com

Then, you can just set your Cache Path & Cache URLs to both be relative, e.g.:

cache/minimee

That should work for you - your caches will be written with CSS containing protocol-relative URL paths to any background image assets, and in your HTML your CSS & JS will be linked with protocol-relative URLs too.

Minimee relies on a full URL to do a lot of its find/replace/guesswork automation, and also make sure that Minimee can run just as smoothly for an EE install running in a subfolder. So a purely relative URL is not really a viable option I’m afraid.  Hopefully the above offers an acceptable alternative.

Cheers,
John