Title: http file
Last modified: October 20, 2022

---

# http file

 *  [doctorofcredit](https://wordpress.org/support/users/doctorofcredit/)
 * (@doctorofcredit)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/http-file/)
 * Hi,
 * When I have autoptimize enabled it seems to be serving the css file from a http
   file rather than https, causing the site to break. Any way to fix it? Have disabled
   autoptimize for now.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fhttp-file%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/http-file/#post-16120713)
 * AO uses [site_url()](https://developer.wordpress.org/reference/functions/site_url/)
   to determine the “root” of URL to the autoptimized files. site_url is based on
   the settings in `wp-admin/options-general.php`, are those both set to `https://`?
 * frank
 *  Thread Starter [doctorofcredit](https://wordpress.org/support/users/doctorofcredit/)
 * (@doctorofcredit)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/http-file/#post-16123315)
 * Yes, both set to https
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/http-file/#post-16123801)
 * surprising .. do you have a staging-site where we could test this?
 *  Thread Starter [doctorofcredit](https://wordpress.org/support/users/doctorofcredit/)
 * (@doctorofcredit)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/http-file/#post-16130399)
 * Not currently unfortunately
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/http-file/#post-16130854)
 * OK, as a root cause analysis is not possible, you could use this code snippet
   which will force the links to autoptimized files to https;
 *     ```
       add_filter( 'autoptimize_filter_js_bodyreplacementpayload', 'ao_forcehttps' );
       add_filter( 'autoptimize_filter_css_bodyreplacementpayload', 'ao_forcehttps' );
   
       function ao_forcehttps( $url ) {
       	return str_replace( 'http://', 'https://', $url );
       }
       ```
   

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

The topic ‘http file’ 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/)

 * 5 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/http-file/#post-16130854)
 * Status: not resolved