Title: Hard coded URLs losing &quot;https&quot;
Last modified: August 20, 2016

---

# Hard coded URLs losing "https"

 *  Resolved [michaelphill](https://wordpress.org/support/users/michaelphill/)
 * (@michaelphill)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/)
 * I have a URL in my WordPress install’s header.php that calls a CSS file from 
   our CDN.
 * `<link rel="stylesheet" type="text/css" media="all" href="https://randomstring.
   ssl.cf2.rackcdn.com" />`
 * But it’s getting changed to
 * `<link rel="stylesheet" type="text/css" media="all" href="http://randomstring.
   ssl.cf2.rackcdn.com" />`
 * As you can see, the “s” gets lost and this isn’t a vallid non-HTTPS URL on the
   Rackspace CDN system. In the Rackspace CDN system, the “ssl” sub-sub-domain is
   replaced with an “r” and a random number on non-HTTPS.
 * I’ve tried setting “Force SSL Exclusively” and “Remove Unsecure Elements” on 
   and off and it still does this. I’ve also tried using the “domain mapping” feature
   to rewrite [http://randomstring.r22.cf2.rackcdn.com](http://randomstring.r22.cf2.rackcdn.com)
   to [https://randomstring.ssl.cf2.rackcdn.com](https://randomstring.ssl.cf2.rackcdn.com).
   Neither works.
 * Any ideas?
 * [http://wordpress.org/extend/plugins/wordpress-https/](http://wordpress.org/extend/plugins/wordpress-https/)

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

 *  Plugin Author [mvied](https://wordpress.org/support/users/mvied/)
 * (@mvied)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494054)
 * Domain Mapping doesn’t work from HTTPS to HTTP, but that is purely an oversight
   on my part. I’ll get it fixed in the next version.
 * In the meantime, you’re more the welcome to try this hack using a filter I provide.
 *     ```
       function wphttps_fix_cdn($url) {
       	return str_replace('ssl.cf2.rackcdn.com', 'r22.cf2.rackcdn.com', $url);
       }
       add_filter('http_external_url', 'wphttps_fix_cdn');
       ```
   
 *  Thread Starter [michaelphill](https://wordpress.org/support/users/michaelphill/)
 * (@michaelphill)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494055)
 * [@mvied](https://wordpress.org/support/users/mvied/): Awesome! Thanks.
 * Just to confirm, which file do I add this string to?
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494057)
 * [@michaelphill](https://wordpress.org/support/users/michaelphill/)
 * It should _probably_ go in the active theme’s `functions.php` file. For example,
   if your site’s active theme is TwentyTwelve, look into the folder named `/wp-
   content/themes/twentytwelve/` for the file named `functions.php`. The code snippet
   should go to the end of the `functions.php` file. Please remove this code, once
   the next version is up, though.
 *  Thread Starter [michaelphill](https://wordpress.org/support/users/michaelphill/)
 * (@michaelphill)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494085)
 * That sort of worked, but now on the pages I have set to be secure, it rewrites
   them to just HTTP.
 *  [venkat008](https://wordpress.org/support/users/venkat008/)
 * (@venkat008)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494221)
 * how to remove hard coded urls to site link i mean ip address to specific site
   address please help me on this.
    thanks in advace..
 *  Plugin Author [mvied](https://wordpress.org/support/users/mvied/)
 * (@mvied)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494223)
 * [@venkat008](https://wordpress.org/support/users/venkat008/) Not sure what you’re
   asking, but start a new topic and be as descriptive as possible.
 * Now, back on topic. I’ve recoded Domain Mapping into URL Mapping in my [development version](http://downloads.wordpress.org/plugin/wordpress-https.zip).
   It’s probably going to be a while before I release this version, so you’re more
   than welcome to give it a shot.
 *  [venkat008](https://wordpress.org/support/users/venkat008/)
 * (@venkat008)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494224)
 * here i have developed one site with every page is hard coded url so here i am
   getting problem of hardcoded while i want to replace server host. i need replace
   all urls please solve this problems.
    thanks in advace
 *  [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * (@pothi)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494225)
 * [@venkat008](https://wordpress.org/support/users/venkat008/) Please read [the forum welcome message](http://codex.wordpress.org/Forum_Welcome)
   and create a new forum topic describing your issue as much as possible. Do **
   not** post in some else’s thread.

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

The topic ‘Hard coded URLs losing "https"’ is closed to new replies.

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

 * 8 replies
 * 4 participants
 * Last reply from: [Pothi Kalimuthu](https://wordpress.org/support/users/pothi/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/hard-coded-urls-losing-https/#post-3494225)
 * Status: resolved