Why use protocol relative URLs?

What are protocol relative URLs?

Normal URLs look like:
https://www.m3server.com/,80
https://www.m3server.com/,443

Both of these URLs define the protocol that will be used.

Protocol relative URLs look like this:
//www.m3server.com/

Dropping the protocol from the URL allows the browser to assign the current protocol to the URL.

Why use protocol relative URLs?

CSS Example:

Protocol Relative CSS
/*Import Google Font*/
@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400);

That will automatically use what the site is being called as, regardless if it is http or https.

NON-Protocol Relative
/*Import Google Font*/
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400);

Rather than state https: or https:, just leave it off on includes.

If your website is on our CDN all requests are served by the CDN.

If you are browsing the site in HTTPS mode, and another user is browsing the same pages in HTTP mode, two versions of those pages will be stored in the CDN cache, as the links are different between the two modes.

This splits your cache, which makes it less efficient.

M3Server.com

Keywords: ssl

About the author

Level 1 Support

Level 1 Technical Support