Home » Website Errors » Page Loads Without Styles or Images: Fixing Broken CSS, JS and Image Paths
Page Loads Without Styles or Images: Fixing Broken CSS, JS and Image Paths
A page that suddenly shows as plain black text on white, with links in default blue and images replaced by small broken icons, has not lost its content. The HTML loaded. What failed are the separate files it asked for: the stylesheet, the scripts, the images. The browser went looking at the addresses in the HTML and found nothing there.
Step 1: open the Network tab
This is the fastest way to see every missing file.
- Right-click the page and choose Inspect (or press F12).
- Open the Network tab.
- Reload the page.
- Click the Status column to sort. Anything in red, usually
404, is a file the browser could not load.
Click a failed row to see the full URL it requested. Compare that with where the file really lives on the server. The difference is your fix.
The Console tab also lists failures, along with JavaScript errors caused by scripts that did not load.
Step 2: read the path carefully
Most broken paths fall into a handful of patterns:
| Requested path | Problem |
|---|---|
file:///C:/Users/me/site/style.css |
Points to your own computer. Never works for visitors. |
https://localhost:8080/... or a staging domain |
Leftover development address. |
css/style.css from /blog/post/ |
Relative path resolves to /blog/post/css/style.css. |
/Images/Logo.PNG vs. real file /images/logo.png |
Linux servers are case-sensitive. |
/wp-content/... on a site moved into /new/ |
Site moved but hard-coded paths did not. |
http:// asset on an https:// page |
Blocked as mixed content. See the mixed content guide. |
Step 3: choose a consistent path style
For hand-built sites, root-relative paths are the least fragile:
<link rel="stylesheet" href="/css/style.css">
<script src="/js/main.js" defer></script>
<img src="/images/logo.png" alt="Company logo">
They work on every page, at any depth, on any domain. The exception is a site that lives in a subfolder; then either include the folder (/shop/css/style.css) or set a <base href="/shop/"> tag once in the <head>.
Step 4: fix moved and migrated sites
After moving a CMS site to a new domain or folder, old addresses stay in the database. For WordPress:
- Update Settings → General (WordPress Address and Site Address).
- Run a search-and-replace across the database for the old URL. WP-CLI does it safely, including serialised data:
wp search-replace 'https://old-site.com' 'https://new-site.com' --dry-run
Remove --dry-run once the preview looks right.
Step 5: check the files really exist
Sometimes the path is correct and the upload was incomplete. Look in the folder over FTP or the file manager. Confirm that:
- The file is there with the exact name and extension.
- It is not zero bytes (an interrupted upload).
- Its permissions allow reading (
644).
Then clear any page cache, optimisation plugin cache and CDN cache, and test in a private window.
Common mistakes
- Fixing one page's paths by trial and error instead of switching to root-relative paths everywhere.
- Renaming
Logo.pngtologo.pngon Windows, where the change may not register, and uploading the old name. - Forgetting the CDN cache, so the fix seems not to work.
- Editing a minified, combined file that a plugin regenerates on the next save.
Frequently Asked Questions
Why does my site look fine locally but break after upload?
Local paths often point to your computer (C:\ or file://) or assume the site runs at the root of a domain. On the server those paths do not exist. Use paths relative to the site root and check filename capitalisation.
What is the difference between /css/style.css and css/style.css?
The leading slash starts from the domain root. Without it, the browser starts from the folder of the current page, so the same line points to different places on different pages.
Can caching cause missing styles?
Yes. A CDN or optimisation plugin may serve an old combined CSS file that refers to files you have since removed. Purge all caches after changing assets.
Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.