{"id":3321,"date":"2014-06-24T14:15:19","date_gmt":"2014-06-24T14:15:19","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2014\/06\/24\/protocol-relative-urls-not-working\/"},"modified":"2023-07-18T12:19:24","modified_gmt":"2023-07-18T16:19:24","slug":"protocol-relative-urls-not-working","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/","title":{"rendered":"Protocol Relative URLs Not Working"},"content":{"rendered":"<style>   .item-page h2 {border:0px;color:#000;padding-right:15px;margin:0px;}   table tr td,   table tr th {vertical-align:top} <\/style>\n<table>\n<tbody>\n<tr>\n<th>\n<h2>Problem:<\/h2>\n<\/th>\n<td>I am using Protocol Relative URLs \/ relative URLs when referencing css and javascript. When I access my page over <span style=\"color: green; font-weight: bold;\">https \/ ssl<\/span>, the css and js is being called over <span style=\"color: red; font-weight: bold;\">http \/ no ssl<\/span>.<\/p>\n<p>It is resulting in the following <a href=\"https:\/\/www.inmotionhosting.com\/support\/website\/error-numbers\/diagnose-javascript-errors\/\">javascript error<\/a>:<\/p>\n<p class=\"alert alert-danger\"><strong>[blocked] The page at<\/strong> &#8216;https:\/\/www.domain.com\/page.php&#8217; <strong>was loaded over HTTPS, but ran insecure content from &#8216;<\/strong>https:\/\/www.domain.com\/style.css<strong>&#8216;: this content should also be loaded over HTTPS.<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<th>\n<h2 style=\"color: green;\">Solution:<\/h2>\n<\/th>\n<td>If you are using the base tag within your header, the protocol being used in your base tag will be used when calling scripts using <em>Protocol Relative URLs<\/em> <strong>\/<\/strong> <em>relative URLs<\/em>.<\/p>\n<pre class=\"code_block\">&lt;head&gt;     &lt;base href='<strong style=\"background: yellow;\">http<\/strong>:\/\/www.domain.com\/page.php' \/&gt; &lt;\/head&gt;<\/pre>\n<p><strong>If you need to use the base tag in your head<\/strong>, make sure to adjust it so that it uses <span style=\"color: green; font-weight: bold;\">https when using ssl<\/span>, and <span style=\"color: red; font-weight: bold;\">http when not using ssl<\/span>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Problem: I am using Protocol Relative URLs \/ relative URLs when referencing css and javascript. When I access my page over https \/ ssl, the css and js is being called over http \/ no ssl. It is resulting in the following javascript error: [blocked] The page at &#8216;https:\/\/www.domain.com\/page.php&#8217; was loaded over HTTPS, but ran<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/\"> Read More ><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4288],"tags":[],"class_list":["post-3321","post","type-post","status-publish","format-standard","hentry","category-website"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Protocol Relative URLs Not Working | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Protocol Relative URLs not working? The problem may be with the base tag in your header.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Protocol Relative URLs Not Working | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Protocol Relative URLs not working? The problem may be with the base tag in your header.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2014-06-24T14:15:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-18T16:19:24+00:00\" \/>\n<meta name=\"author\" content=\"Brad Markle\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brad Markle\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/\"},\"author\":{\"name\":\"Brad Markle\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf\"},\"headline\":\"Protocol Relative URLs Not Working\",\"datePublished\":\"2014-06-24T14:15:19+00:00\",\"dateModified\":\"2023-07-18T16:19:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/\"},\"wordCount\":140,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Website\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/\",\"name\":\"Protocol Relative URLs Not Working | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2014-06-24T14:15:19+00:00\",\"dateModified\":\"2023-07-18T16:19:24+00:00\",\"description\":\"Protocol Relative URLs not working? The problem may be with the base tag in your header.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Protocol Relative URLs Not Working\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf\",\"name\":\"Brad Markle\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/bradm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Protocol Relative URLs Not Working | InMotion Hosting","description":"Protocol Relative URLs not working? The problem may be with the base tag in your header.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/","og_locale":"en_US","og_type":"article","og_title":"Protocol Relative URLs Not Working | InMotion Hosting","og_description":"Protocol Relative URLs not working? The problem may be with the base tag in your header.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2014-06-24T14:15:19+00:00","article_modified_time":"2023-07-18T16:19:24+00:00","author":"Brad Markle","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Brad Markle","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/"},"author":{"name":"Brad Markle","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf"},"headline":"Protocol Relative URLs Not Working","datePublished":"2014-06-24T14:15:19+00:00","dateModified":"2023-07-18T16:19:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/"},"wordCount":140,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Website"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/","name":"Protocol Relative URLs Not Working | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2014-06-24T14:15:19+00:00","dateModified":"2023-07-18T16:19:24+00:00","description":"Protocol Relative URLs not working? The problem may be with the base tag in your header.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/protocol-relative-urls-not-working\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Protocol Relative URLs Not Working"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf","name":"Brad Markle","url":"https:\/\/www.inmotionhosting.com\/support\/author\/bradm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":{"id":4288,"name":"Website","slug":"website","link":"https:\/\/www.inmotionhosting.com\/support\/website\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=3321"}],"version-history":[{"count":3,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3321\/revisions"}],"predecessor-version":[{"id":105718,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/3321\/revisions\/105718"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=3321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=3321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=3321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}