Remove Domain Part, WordPress-plugin

If you have your WordPress multisite installed on a subdomain like wp.example.com, this plugin removes the wp. part from new subdomain sites.

Before plugin

site1.wp.example.com
site2.wp.example.com

After plugin

site1.example.com
site2.example.com

It only makes sense for WordPress Multisite installations (former WordPress MU).

Download version 1.2 here:

http://tech.velmont.net/wp-content/plugins/remove_domain_part.txt

How to actually use this?

You probably want to follow my guide Howto use subdomain WordPress Multisite 3.x (3.0 and 3.1) without dashboard site?

If you’re in a hurry, in short:

  1. Install plugin
  2. If your dashboard (hub page) isn’t called wp.example.com, you have to change REMOVE_DOMAIN_PART in the plugin to what you use. E.g. define('REMOVE_DOMAIN_PART', '.mydashboard.'); (the dots are important).
  3. Network activate it

However, you probably want this plugin with a few others to have a good setup. So read the howto.

Changelog

1.2

This release handles frontend signups.

  • You have to Network active the plugin now, because it needs to run on the blog sites when they get activated.
  • It will rewrite activation emails, removing any instances of REMOVE_DOMAIN_PART that it can find.
  • It will now also rewrite the blog URL upon activation

1.1

Support the more picky PHP setups. Fixes some errors and warnings.

1.0

Initial version.

14 thoughts on “Remove Domain Part, WordPress-plugin”

  1. i get this error when i activate the plugin and try to create a new site. please help.

    Warning: Missing argument 2 for remove_domain_part() in /home8/donmedpo/public_html/multisite/wpm/wp-content/plugins/removedomainpart.php on line 17

    Warning: Missing argument 3 for remove_domain_part() in /home8/donmedpo/public_html/multisite/wpm/wp-content/plugins/removedomainpart.php on line 17

    Warning: Missing argument 4 for remove_domain_part() in /home8/donmedpo/public_html/multisite/wpm/wp-content/plugins/removedomainpart.php on line 17

    Warning: Missing argument 5 for remove_domain_part() in /home8/donmedpo/public_html/multisite/wpm/wp-content/plugins/removedomainpart.php on line 17

    Warning: Missing argument 6 for remove_domain_part() in /home8/donmedpo/public_html/multisite/wpm/wp-content/plugins/removedomainpart.php on line 17

    Warning: Cannot modify header information – headers already sent by (output started at /home8/donmedpo/public_html/multisite/wpm/wp-content/plugins/removedomainpart.php:17) in /home8/donmedpo/public_html/multisite/wpm/wp-includes/pluggable.php on line 897

  2. That doesn’t make any sense.

    I could code around that, but all the arguments should be there, because the hook is only called in one place.

    I need to know what version you’re running. The error code doesn’t really make any sense, as I’ve looked at the source code for both WP 3.0 and 3.1, and they both call the hook in the same way. :-)

    I’ll look at it.

  3. Hello,

    I can’t install the plugin, I get the followintg error:

    Plugin could not be activated because it triggered a fatal error.

    Parse error: syntax error, unexpected T_STRING in /home/teshir1/public_html/help/wp-content/plugins/remove_domain_part.php on line 42

    Using WP 3.1.3

    Any fix on this?

    Thanks

  4. Teshir: Whoa there! I’m actually working directly on the plugin for version 1.2, trying to fix Pierre’s problem.

    I didn’t know the plugin was so popular that someone would try to download it in the middle of my debugging!

    So it is just a race condition, you downloaded the file when I had made some partway changes, and not the full ones.

  5. Is there a full version coming out soon?

    Once I test this and verify it works, I will send it to my list of WP users, its a modest list of 800 people, but most of them need this kind of fix.

    Hopefully you can help, I know you’re doing this for free and out of your spare time, but I’m sure many of us would be up to buying you a beer for a complete plugin that can take care of this.

    Best,

    Teshir

  6. Teshir: If you could hard-refresh the plugin page now, and try it. It should work now.

    However, do mind that I have changed the howto; because Remove Domain Part 1.2 needs to be Network Activated to get full functionality.

    It passed all my tests now.

  7. Hello,

    Thanks for the quick reply.

    I was able to install it, and enable it via Network Enable.

    However, I can’t get it to change the names.

    I may be missing a point here.

    I have WP with network enabled, have the plugin network installed, but when I go to the “hub” website the plugin does not show up.

    Any thoughts?

  8. Teshir: What is your dashboard site? Is it called wp.yourdomain.com? If it ISN’T, you have to change REMOVE_DOMAIN_PART in the plugin from .wp. to what you use.

    Say you use mydashboard.mydomain.com as your dashboard/main site; then you need to change REMOVE_DOMAIN_PART in the plugin to .mydashboard., mark the dots are important.

    The plugins that are network activated doesn’t normally show up as plugins on individual sites, but it should still be active there.

  9. Hello,

    Thanks for the update.

    I have actually set it up the way you say.

    In my case, my “main dashboard” is: help.domain.com

    so I changed it to: .help.

    However, I think I know why, and dumb me!

    ServerAlias is not yet configured properly. I am now looking into re-doing the entire thing and then trying the plugin.

    I will update you with my progress tomorrow, as it is 2 AM now and I think a fresh set of eyes will be best.

    Thank you for all your kind help. I will for sure get back here with the results.

    Best,

    Teshir

  10. For our setup we needed automagic discovery of the third-level / subdomain-part (because of deployment on multiple servers) and so I wrote a quick 2-liner that’ll extract the subdomain-part out of your server’s hostname:

    Just replace the first line of actual code in v 1.2 of the plugin with the following:

    // Discover the subdomain part of the installation we are running on
    list($subdomain, $rest) = explode('.', exec('hostname -f'), 2);
    
    // Setup the subdomain with '.bar.' because WordPress builds
    // fourth-level domains like foo.bar.domain.com
    $subdomain_with_fullstops = '.'.$subdomain.'.';
    define('REMOVE_DOMAIN_PART', $subdomain_with_fullstops);
    

    Hope it helps somebody should they encounter a similar deployment-situation.

  11. Dear Odin, I would like to ask you a question about mapping domain names, because your blog is the closest thing to a question anywhere :).

    I have a multisite install in which i have some test sites. But i am hosting other sites on that same server.

    My question is (to make it short): Is there, or have you ever heard of, a way to have a wordpress multisite with domain mapping where I could also add a domain map to a real subdomain (not a virtual multisite subdomain). In this subdomain I have a regular wordpress install.

    I was just wondering about this, hoping it exists, to make my life in DNS easier…..

    Looking forward to your answer, if you think this is interesting :)

    best regards, Lesley

Leave a Reply to Tobias Cancel reply

Your email address will not be published.

Musings about video, html, tech and linux