-1

All The links declared are set to :// instead of http:// even though they have https added in the code. This is causing a issue with AMP page validation. Is there a way i can force http:// here?

closed as off-topic by Mark Kaplun, TheDeadMedic, bueltge, kaiser Sep 11 '16 at 13:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    So they're relative, you've set them to be https but you want to force to http? None of this makes sense. If they're relative and you go to https they will be https, similarly if they're relative and you go to http they will be http. So if you've added https: in code then even if they weren't relative, you'd be going to https not http. Can you update your question please as I'm not sure you're using https and http where you mean to. Otherwise look at .htaccess files for redirect rules – TommyBs Sep 7 '16 at 6:13
  • Im making an amp page. so ive added the cdn for the amp's js. The cdn links hovever come out as //cdn.ampproject.org/v0/amp-youtube-0.1.js aren't recognized by the validator. so some how i would like to force http or https on the link it. – Panic Sep 7 '16 at 6:23
  • these are totally commun URL then if they aren't recognized by the validator, there is a problem with the "validator". what is the error message ? – mmm Sep 7 '16 at 6:28
  • have no relevance to wordpress and therefor off-topic here, unless there is a wordpress code you can attach to the question – Mark Kaplun Sep 7 '16 at 6:33
  • I believe wordpress is omitting the http: part from the url. The validator has to validate the page in order for amp to be usable. so i have to adapt and was hoping i would find a way to force the http part through wrodpress. – Panic Sep 7 '16 at 6:40
1

When you are on HTTP and your browser requests an external script using hardcoded HTTPS, it safe. When you do otherwise, it's not safe. So, the best practice is not to hardcode the protocol in your code.

Safety is No. 1 priority, validation is secondary. So, keep relative // instead of explicit http:// of https://.

Or, you can move your site to SSL and use https:// in every link.

  • Im sorry but the validation has to be a priority for amp pages as they're not usable otherwise. – Panic Sep 7 '16 at 6:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.