WordPress – a theme loads CSS from a different URL than the Site URL

Yesterday I changed both my Home URL and Site URL to a new value (let’s call it “address 2”). It changed perfectly, no problems were present. Today I tried accessing the website and found that I can’t do it, so in wp-config.php I restored those URLs to previous values (let’s call it “address 1”). It worked and loaded the website, but CSS and images weren’t loading at all.

I looked up this problem in the Firebug and saw that theme files (images and CSS) are being loaded from the new address (address 2) I specified yesterday, but the back-end and the HTML are loading from the old one (address 1).

Read More

I have no idea what is going on.

Pictures:
Current Site URL and Home URL settings:
Current settings

The website works with address 1, though it’s not loading CSS and images:
Website works

Website is trying to load CSS from address 2, I don’t know why:
Wrong address for stylesheet

Could you please help me with that? It’s very important for my work.

Related posts

Leave a Reply

3 comments

  1. You could also use the built in update function. You’ll need to modify your functions.php file with the following, then update (afterwards you can remove this from the functions.php again):

    update_option('siteurl','http://www.new-site-address.com');
    update_option('home','http://www.new-site-address.com');
    

    You can find more information about Moving WordPress Sites here: http://codex.wordpress.org/Moving_WordPress

  2. Although jme11’s solution didn’t fix the problem it helped me to find a solution to it. I had to set the relocation flag, after which you can log in from any valid address to wp-login.php file, and WordPress will set the SiteURL and HomeURL to the address you typed in the browser.

    I had to add define('RELOCATE',true); just before the line informing about the end of the usable part of the document.

    Thank you guys.

  3. If it doesn’t change in the theme, that’s strange. I’ve never had that before.

    But I did have that problem of migrating WP sites to a new home with lots of broken links afterwards. This is because WP saves links inside e.g. posts in the database and usually won’t change them even if it’s pointing to this very WP installation.

    What I’d try is downloading a backup SQL file of the whole database WordPress uses (for example, with phpMyAdmin) and then run a search for http://xxx.xxx.183.18:8001/ (whatever your WP URL was before). If you get any hits, run a bulk search-and-replace to exchange the old IP with the new one, save the SQL file, then import it into a new database and let WP use that new database.