Support » Plugin: WordPress MU Domain Mapping » [Plugin: WordPress MU Domain Mapping] normalizing resource url with filter

  • shackep


    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.


Viewing 1 replies (of 1 total)
  • Plugin Author Ron Rennick


    MultiSite Guru

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

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WordPress MU Domain Mapping] normalizing resource url with filter’ is closed to new replies.