WordPress MU Domain Mapping
normalizing resource url with filter (2 posts)

  1. shackep
    Posted 4 years ago #

    Outputting Canonical Resource urls across a multisite network

    I am setting up an e-commerce site and am just a hair away from having everything clear for SSL. Here is my predicament. I have one bit of .js that keeps on displaying content from the pre-domain mapped url. Looking at the .js file I see that that url is generated based on the plugins_url. The rest were taken care of using .haccess

    Using MikeSchinkel's advice, I added:

    function normalize_resource_url($url) {
      if (MULTISITE) {
        $site_url = get_site_url(BLOG_ID_CURRENT_SITE);
        if (SUBDOMAIN_INSTALL) {
          $url = preg_replace("#^(https?://[^/]+)(/wp-.*\.(css|js))?$#","{$site_url}\\2",$url);
        } else {
          $url = preg_replace("#^({$site_url})(/[^/]+)(/wp-.*\.(css|js))?$#",'\1\3',$url);
      return $url;

    But I don't know how this interacts with your domain mapping plugin or if there is something missing that would make it actually work. Any help would be much appreciated.



  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 4 years ago #

    Upgraded MU installs will not have the MULTISITE constant.

    Upgraded MU installs may not have either the BLOG_ID_CURRENT_SITE or the SUBDOMAIN_INSTALL constant.

    There are functions you should use


    If you are using cross domain js then you need to add a header to the output on the server side to tell the browser security that the cross domain request is ok (and not a malicious script).

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress MU Domain Mapping
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic