Title: It generate http:// instead of https:// for optimized file
Last modified: August 31, 2016

---

# It generate http:// instead of https:// for optimized file

 *  Resolved [Victor_K](https://wordpress.org/support/users/yylzcom/)
 * (@yylzcom)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/it-generate-http-instead-of-https-for-optimized-file/)
 * Everything worked fine until I turned on http protocol on 80 port, just for Let’s
   Encrypt verification.
 * I found that JS and CSS was not load because they are use http protocol instead
   of https.
 * I now turn off http to see if this error happen again or not.
 * Can you please check or just use relative protocol?
 * Thanks very much for this plugin.
 * [https://wordpress.org/plugins/autoptimize/](https://wordpress.org/plugins/autoptimize/)

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

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/it-generate-http-instead-of-https-for-optimized-file/#post-7065510)
 * hi yylzcom;
    as per [this line in autoptimize.php](https://github.com/futtta/autoptimize/blob/master/autoptimize.php#L195),
   the protocol used is actually the one returned by wp core’s [content_url()](https://codex.wordpress.org/Function_Reference/content_url)
   which is based on the WP_CONTENT_URL constant and which as per the codex;
 * > retrieves the url to the content area for the current site with the appropriate
   > protocol, ‘https’ if [is_ssl()](https://codex.wordpress.org/Function_Reference/is_ssl)
   > and ‘http’ otherwise.
 * Obviously the limitations of is_ssl (cfr. codex) apply here as well.
 * As a workaround you could either set WP_CONTENT_URL in wp-config.php or you could
   set your https-URL as the CDN base URL in Autoptimize.
 * Hope this clarifies,
    frank
 *  Thread Starter [Victor_K](https://wordpress.org/support/users/yylzcom/)
 * (@yylzcom)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/it-generate-http-instead-of-https-for-optimized-file/#post-7065628)
 * I did as you suggest, but did not work. The true reason is the wp-super-cache
   plugin. Once load page from HTTP protocol for the first time, it will build the
   cache with HTTP url, even if I setup CDN base to https address in wp-super-cache.
 * Plugin author said “[There is no fix for this outside of creating rewrite rules in your .htaccess file to control if a page is forced to/from HTTPS](https://wordpress.org/support/topic/https-and-wp-super-cache?replies=2)“
 * I have to do this after I successfully sign the cert from Let’s Encrypt. As long
   as the cert is valid, the renewal can be done via HTTPS.

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

The topic ‘It generate http:// instead of https:// for optimized 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/)

 * 2 replies
 * 2 participants
 * Last reply from: [Victor_K](https://wordpress.org/support/users/yylzcom/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/it-generate-http-instead-of-https-for-optimized-file/#post-7065628)
 * Status: resolved