3

I am witnessing a strange problem in WordPress which automatically removes 'http' from my sub domain link. I don't know why this is happening.

Note that my domain is https while it's subdomain is http.

My WordPress is installed in my main domain. When I add the below url of my sub domain to any post:

<a href="http://www.demo.yogihosting.com/jquery/jquery-removedata/">DEMO</a>

Then it automatically converts it to:

<a href="//www.demo.yogihosting.com/jquery/jquery-removedata/">DEMO</a>

See that the http is gone from the URL.

Also see this below gif image which lists this problem:

enter image description here

Why this is happening and how to solve this problem.

1

3 Answers 3

1

You might find that you do not want to solve this one. Links starting //example.com are protocol agnostic. This means it will load over whatever the site it is on loads over. Be that http, https, or some truly esoteric.

You should find that links like this work in both secure and insecure connections just fine. It looks odd if you have never seen it before but it works really well.

6
  • But in my case I have a 'demo' subdomain which starts with 'http' and not 'https'. I know my domain (i.e. main domain) is https. So when I create a link to my subdomain (i.e. demo.yogihosting.com/jquery/jquery-removedata) then it is changed to '//www' automatically i.e. it is taking the protocol of my main domain (i.e. https). This thing i don't want, but why wordpress is doing it and any way i can stop it? Thank you. Commented Sep 13, 2019 at 17:30
  • Ah, I see. It is a cross-site http/s issue. Hmm... Let me have a think and then get back to you (assuming no one else gives a better answer first). Commented Sep 13, 2019 at 21:16
  • Protocol relative URLs are an anti-pattern. HTTPS should always be used if it's available. See the update here: paulirish.com/2010/the-protocol-relative-url Commented Sep 14, 2019 at 2:34
  • @JacobPeattie I don't want to use 'https' for my subdomain and that is the issue. Commented Sep 14, 2019 at 8:40
  • That doesn’t have anything to do with my comment or link. It was addressed to Matthew’s answer. However, there’s no good reason to not want https. Commented Sep 14, 2019 at 9:29
0

Are you using any SSL plugin? If not it might be becauee you enabled Full or flexible SSL in Cloudflare.

Dude, why would you add www in front of your subdomain? zeez 🙄

1
  • I am using cloudflare and it's ssl. I don't think ssl will do this type of thing. Commented Sep 17, 2019 at 4:45
0

A proper subdomain takes the place of the 'www', which should not be there at all.....so your subdomain URL should be "http://demo.yogihosting.com/jquery/jquery-removedata/" instead of as you show it above......perhaps you have a typo in your original question?

2
  • no typo at all. Commented Sep 17, 2019 at 18:04
  • Sorry Diana, I was hoping that was it.....I can't recreate this after testing several recent versions of WP, when I add a link using both the www. (which is, in itself a subdomain) and a subdomain, both stay in place as does the http: - my versions do not remove the http: as yours does. I could be wrong, but have been taught by many more experienced webmasters that when using a subdomain you drop the www. ....though it seems to work it can cause confusion.
    – Trisha
    Commented Sep 18, 2019 at 22:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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