WordPress.org

Ready to get started?Download WordPress

Forums

WordPress HTTPS (SSL)
[resolved] Hard coded URLs losing "https" (9 posts)

  1. michaelphill
    Member
    Posted 1 year ago #

    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 to https://randomstring.ssl.cf2.rackcdn.com. Neither works.

    Any ideas?

    http://wordpress.org/extend/plugins/wordpress-https/

  2. Mvied
    Member
    Plugin Author

    Posted 1 year ago #

    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');
  3. michaelphill
    Member
    Posted 1 year ago #

    @Mvied: Awesome! Thanks.

    Just to confirm, which file do I add this string to?

  4. Pothi
    Member
    Posted 1 year ago #

    @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.

  5. michaelphill
    Member
    Posted 1 year ago #

    That sort of worked, but now on the pages I have set to be secure, it rewrites them to just HTTP.

  6. venkat008
    Member
    Posted 1 year ago #

    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..

  7. Mvied
    Member
    Plugin Author

    Posted 1 year ago #

    @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. It's probably going to be a while before I release this version, so you're more than welcome to give it a shot.

  8. venkat008
    Member
    Posted 1 year ago #

    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

  9. Pothi
    Member
    Posted 1 year ago #

    @venkat008 Please read the forum welcome message and create a new forum topic describing your issue as much as possible. Do not post in some else's thread.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic