Title: Doesn&#039;t work correctly on https
Last modified: August 22, 2016

---

# Doesn't work correctly on https

 *  [manishie](https://wordpress.org/support/users/manishie/)
 * (@manishie)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/doesnt-work-correctly-on-https/)
 * I was able to fix it in attachment.php by inserting these lines:
 *     ```
       $orig_url = $url;
       $url = preg_replace("/https?:\/\//", '', $url);
       $home = preg_replace("/https?:\/\//", '', $home);
       ```
   
 * just before this line:
 *     ```
       $filename = ABSPATH . substr($url, strlen($home) + 1);
       ```
   
 * and by changing this line:
 *     ```
       'url' => $url,
       ```
   
 * to:
 *     ```
       'url' => $orig_url,
       ```
   
 * [https://wordpress.org/plugins/json-api/](https://wordpress.org/plugins/json-api/)
 * i’m sure there’s a more elegant way to fix it, but here’s my messy attempt.
 * thanks!

The topic ‘Doesn't work correctly on https’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/json-api.svg)
 * [JSON API](https://wordpress.org/plugins/json-api/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/json-api/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/json-api/)
 * [Active Topics](https://wordpress.org/support/plugin/json-api/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/json-api/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/json-api/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [manishie](https://wordpress.org/support/users/manishie/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/doesnt-work-correctly-on-https/)
 * Status: not resolved