
The short answer: a link or an image can name its target in four ways: absolute (https://yourcompany.com/img/logo.png), protocol-relative (//yourcompany.com/img/logo.png), root-relative (/img/logo.png) and relative to the page (img/logo.png or ../img/logo.png). The browser completes the incomplete ones from the address of the page it is on, not from where the file sits on the server. Each form survives a different kind of move, which is why a site that worked perfectly breaks on some pages after changing domain, switching to https or moving into a folder.
The four forms, and what breaks each
| Form | Survives | Breaks when |
| Absolute: https://yourcompany.com/img/logo.png | Being copied outside the site: e-mails, social networks, other sites. | The site changes domain (it keeps pointing to the old one) or folder. If written with http://, it causes mixed content after the switch to https. |
| Protocol-relative: //yourcompany.com/img/logo.png | The switch from http to https. | The site changes domain. Today, with everything on https, writing https:// is simpler. |
| Root-relative: /img/logo.png | A domain change and the switch to https. | The site moves into a folder (yourcompany.com/new/): it keeps looking at the root. |
| Relative to the page: img/logo.png, ../img/ | A domain change, https, and the whole site moving into a folder. | The page address changes depth. With friendly URLs, on /blog/my-post/ the browser looks for /blog/my-post/img/logo.png. |
Finding and fixing the links that broke
|
|
|
|
|
|
| An old domain that still works hides the problem. Images and files loaded from the old address appear normally until the day that domain or the old hosting account is cancelled, and then everything breaks at once. In the Network tab, make sure no request goes to the old domain before you let it go: after moving a site. |
| When switching to https, absolute links written with http:// cause nearly all mixed content: mixed content after moving to HTTPS. |
|
Moved the site to another domain or folder and some pages lost their images or link to the old place? Send us an address that fails and the site’s old address. Open a support ticket |
RECOMMENDED PRODUCT Register your .com domain Secure your company name before someone else registers it. from £13.60/yr Search a domain |











