Support » Fixing WordPress » stylesheet href URL changes overnight

  • Resolved bduffey



    We have recently moved (copied) a ‘live’ site from one server to another, due to needed PHP and CentOS upgrades. The site on the new server works great, EXCEPT, over night the stylesheet href URLs convert from the domain name, to the server name…which breaks all the site styling.

    This morning, the URLs reset to the proper domain address…after I, simply, refreshed the WordPress login page. I did not login to the Dashboard, I just refreshed the page…and all the stylesheet href URLs switched back to the correct domain name paths.

    I did not copy the site files over from the ‘live’ server, nor did I do any WP config, on the server-side. I don’t have server admin access.

    Any idea as to what is causing this to happen? I did check the wp-config.php file (through Filester) and everything looks ok to me. I believe a URL find/replace app was used by the server admin, after the files were copied over. Perhaps that wasn’t configured properly?

    Any ideas would be appreciated. We can’t cutover to this new server until this issue is resolved.

    Thanks, in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Without seeing your site we can only guess. MY guess some of the URL were hardcoded into the template. Style sheets and scripts are usually are enqueued in the functions.php file. WordPress provides functions for determining the URL to your script. So if you move the site these functions will figure out the new url and use it. If however, the URLs have been hardcoded into the theme. It will try to use the URLs provided in the template. There are plugins that will bundle and move your files to and help avoid this problem.

    It could also be you have cached some of the files in your browser. You can try clearing your browser cache and see if that helps.

    You might want to add some more information to your post. Like the URL to your site and the name of the theme, you are using.

    Thread Starter bduffey


    Thanks for the info, mrtom414.

    Right now, unfortunately, the site is only accessible on our network. My bad, I should have mentioned that.

    We’re using a custom theme, developed by a previous developer.

    I just checked the functions.php file and all the stylesheet paths are relative and everything seems to be correct.

    So, something server-side must be over-riding those paths, and changing them to the server name path.

    That said, I don’t understand why just refreshing the login page would resolve the issue, and switch the URLs back to relative??

    When you enqueue a script you get the full path by using the WordPress built in function get_template_directory_uri() followed by the relative path to what you want to install.

    Example get_template_director_uri() . “/style.css”. The function

    get_template_directory_uri() will figure out the path to your theme’s directory. You can then add the relative path to it. If you are just creating a static path you will have problems when you move the site.

    Thread Starter bduffey


    that all makes sense and seems to be in order in my functions.php enqueue script. all the stylesheet paths are relative.

    we’re trying to figure out why the paths change, over night, from:


    I’m told our security team runs a scan every night. I’m not sure if this is what is triggering the event. nor, do I know why the URLs would reset to the server name, instead of the domain name.

    Thread Starter bduffey


    Issue Resolved: my server admin added the hostname, to be used as a virtual server, on the new, test, server. that fixed the issue. still not sure what was triggering the event, over night, but we’re good to go.



    Thread Starter bduffey


    resolved. see above. thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.