Title: CSS Optimisation issue
Last modified: October 20, 2018

---

# CSS Optimisation issue

 *  Resolved [Lee](https://wordpress.org/support/users/leewickham/)
 * (@leewickham)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/)
 * Getting 404 Bad Requests on the following after selecting to have CSS optimized:
 * **URL’s Before Enabling Optimise CSS:**
 *     ```
       https://static.discodj.co.uk/themes/Avada/assets/images/shadow-top.png
       https://static.discodj.co.uk/themes/Avada/assets/images/shadow-bottom.png
       https://static.discodj.co.uk/plugins/all-in-one-schemaorg-rich-snippets/css/delete.gif
       ```
   
 * **URL’s After Enabling Optimise CSS:**
 *     ```
       https://static.discodj.co.uk/wp-content/themes/Avada/assets/images/shadow-top.png
       https://static.discodj.co.uk/wp-content/themes/Avada/assets/images/shadow-bottom.png
       https://static.discodj.co.uk/wp-content/plugins/all-in-one-schemaorg-rich-snippets/css/delete.gif
       ```
   
 * The issue here is that my subdomain static.discodj.co.uk already points to the“/
   wp-content/” after enabling the option to optimise CSS the plugin is finding 
   thease URL’s and appending “/wp-content/” to them where it should not.
 * Any way I can prevent this from happening?
    -  This topic was modified 7 years, 7 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbug-css-optimisation-issue%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/#post-10462650)
 * Hey Lee;
    AO indeed assumes CDN/ static URL’s to have identical structure as 
   your origin URL, so including `wp-content`. that being said; you can instruct
   AO to do otherwise by hooking into the API, using the `autoptimize_filter_css_fixurl_newurl`(
   new in AO 2.4), see [https://wordpress.org/support/topic/static-file-domain-does-not-work-with-relative-path-css-fonts/](https://wordpress.org/support/topic/static-file-domain-does-not-work-with-relative-path-css-fonts/)
   for some more info 🙂
 * hope this helps,
    frank
 *  Thread Starter [Lee](https://wordpress.org/support/users/leewickham/)
 * (@leewickham)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/#post-10462754)
 * Ahh, awesome!, ill give that a try, thanks for the heads up xD
 *  Thread Starter [Lee](https://wordpress.org/support/users/leewickham/)
 * (@leewickham)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/#post-10464754)
 * Hey Frank, sorry to be a pain, how would I go about using that new filter exactly,
   Do I need to add it to my child theme/s function.php?
 * apologies I don’t quite follow the example you linked to.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/#post-10464972)
 * you could indeed add it to your child theme’s function.php and it would probably
   look something like this;
 *     ```
       add_action('autoptimize_filter_css_fixurl_newurl','subdomain_magic');
       function subdomain_magic($urlin) {
           return str_replace('wp-content/','',$urlin);
       }
       ```
   
 *  Thread Starter [Lee](https://wordpress.org/support/users/leewickham/)
 * (@leewickham)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/#post-10465018)
 * Ahh magic! Many thanks, love the plugin, keep up the amazing work xD
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/#post-10465234)
 * you’re welcome Lee, feel free to [leave a review of the plugin and support here](https://wordpress.org/support/plugin/autoptimize/reviews/#new-post)!
   🙂
 * have a nice day,
    frank
 *  Thread Starter [Lee](https://wordpress.org/support/users/leewickham/)
 * (@leewickham)
 * [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/#post-10522594)
 * Hey Frank, Just a quick update.
 * The solution you provided is working perfectly! xD thanks again!
 * Have left you a review as well!
 * kind regards!
    Lee

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘CSS Optimisation issue’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Lee](https://wordpress.org/support/users/leewickham/)
 * Last activity: [7 years, 10 months ago](https://wordpress.org/support/topic/bug-css-optimisation-issue/#post-10522594)
 * Status: resolved