简体   繁体   中英

Turning on the ssl breaks the website

I was trying to turn on the ssl in http://top-minecraft-servers.com but it breaks. All the relative url like /userdata etc which are used in the img tag or as href it points to http not https. For example

<a style="text-transform: uppercase;" id="vote" class="btn btn-default serv-vote-btn" <? echo $account_user_id ?>"  href="/vote"> 

is going to

http://top-minecraft-servers.com/vote

not

 https://top-minecraft-servers.com/vote

My question is how to do it easily while not hardcoding all the links because hardcoding all the links will be very problematic.

Please help Thanks

You have a base href tag in your document which is the problem:

<base href="http://top-minecraft-servers.com/">

You need to change that as well to https:

<base href="https://top-minecraft-servers.com/">

Or, simply just remove it altogether. I'm not sure it's serving any purpose at all.

If you have a base tag present, it's href attribute is basically prepended to all relative links in the document, effectively making them all absolute links

See here: https://developer.mozilla.org/en/docs/Web/HTML/Element/base

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM