WordPress.org

Ready to get started?Download WordPress

Forums

Simple Domain Mapping without any Plugins (WordPress 3.0) (14 posts)

  1. chrisbrocklesby
    Member
    Posted 3 years ago #

    Morning All,
    First thing first, I love WordPress 3.0 its looking really good and is going to be a great assist to me and my web media business.

    I have just installed WordPress 3.0 rc1 and all is working great, I wanted to bring all my site together under one blogging/site network... But I didn't like the idea of sub-domains nor using a 3rd party plugin to install Domain Mapping, I also found on the web a way of mapping a domain but you had to edit the mySql data which again I thought was messy...

    So I may be wrong here but I have installed my own domains on each new site rather than sub-domains with one small tweak to the wp-config and the site options in 'Super Admin'... My setup is as follows assuming you have subdomain multisite setup already...

    1) I have my Wildcard DNS name setup so all domains point to the main sites IP Address... (search google fo info)

    2) I setup a subdomain site from within the WordPress Super admin panel like normal...

    3) Go into Sites in your Super Admin Panel, click 'edit' for that site, the change the 'Domain' from 'mysite.mydomain.com' to the domain you wish for that site eg mynewdomain.com...

    4) Click 'Update Options'...

    5) At this point your newly mapped domain name should be working.... But the wp-admin login will not work it seems to redirect in a loop....

    6)To fix the wp-admin loggin you need to comment out define( 'DOMAIN_CURRENT_SITE', 'mydomain.com' ); in the wp-config.....

    eg:
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/';
    //define( 'DOMAIN_CURRENT_SITE', 'mydomain.com' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    7) Thats it... it should all be working... (depending on your server setup)

    I was worried by doing this is would maybe do some sort of weird header redirect on the server but after testing I get a 'HTTP/1.1 200 OK' which is great...

    Anyway this worked for me and it early days, but I thought I would share... Finger crossed this very small tweak will do the trick and work for other...

    Kind Regards,
    Chris

  2. chrisbrocklesby
    Member
    Posted 3 years ago #

    Ok ok.... ;) .... I found a small error...

    define( 'DOMAIN_CURRENT_SITE', 'mydomain.com' );
    is needed for login and other things (I must of had old cookies in my browser...)

    So Step (6) don't comment out that line, just replace it with...

    define( 'DOMAIN_CURRENT_SITE', ''. $_SERVER['HTTP_HOST'].'' );

    This tells the server to get the current domain (if your server supports it) for the logon cookies and other site url lookups...

    Anyway as I said this is just something I am trying and it is current working for me, and I hope it can help someone else...

    Kind Regards,
    Chris

  3. Yep. The domain mapping is really a user interface.

    Edit those details in the backend is exactly the same as editing the database.

  4. teggen
    Member
    Posted 3 years ago #

    Hi. Thanks for sharing. I have set up my 3.0 using subfolders instead of subdomains. Do you know if the same procedure applies also for this setup?

    Best regards,
    Terje

  5. jk3us
    Member
    Posted 3 years ago #

    This is working for me so far... all sites work, can log in. I wonder if we're missing something that will break horribly down the road :)

    define( 'DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST'] );

  6. John Levandowski
    Member
    Posted 3 years ago #

    Works great for me also. One thing I found is that if you are using wildcard subdomains, when you type in a url without a site configured at that address it sends the site into a redirect loop.

    To fix this I added:
    define('NOBLOGREDIRECT', 'http://example.com');
    to my wp-config.php

  7. @teggen - yes, subdomains or subfolders, doesn't matter.

    Actually, I DO recommend using the plugin as the included sunrise.php files helps with letting WP know you have some mapped domains before the rest fires up.

  8. chrisbrocklesby
    Member
    Posted 3 years ago #

    Glad its working for you guys...

    @jlevandowski great fix...

  9. praeix
    Member
    Posted 3 years ago #

    I know this is an old thread, but my question is regarding using subfolders instead of subdomains.

    Do you need to use a wildcard DNS if you're only using subfolders? To me, it doesn't seem logical, but I'm wanting to make sure.

  10. Do you need to use a wildcard DNS if you're only using subfolders?

    Nope. Not for just MU. Probably yes for network domains, though.

  11. praeix
    Member
    Posted 3 years ago #

    I'm trying to follow all these instructions for getting different domains to work, but EVERYBODY uses a subdomain example and not a subfolder example and it's confusing, plus it's NOT working for me.

    Here's my domain: maindomain.com

    Here's what I did:
    1. Installed the network for maindomain.com using Codex instructions.
    2. Created a site using the Super Admin panel and filled it in as follows: maindomain.com/secondarydomain/ (secondarydomain is the name of the folder that my second site resides)
    3. Clicked edit for the "secondarydomain" site that I just created.
    4. Changed the domain settings from "maindomain.com" to "secondarydomain.com" and change the path from "secondarydomain" to "/".
    5. Unchecked the "Update siteurl and home as well" box and filled those values in manually as "secondarydomain.com".
    6. Updated the "Fileupload Url" from "maindomain.com/secondarydomain/files" to "secondarydomain.com/files".
    7. Clicked "Update Settings".
    8. Attempted to log by using "secondarydomain.com/wp-admin" and instead of taking me there, it gives me a Forbidden 403 error. Where it gets weird is that the URL box switches from "secondarydomain.com/wp-admin/" to "secondarydomain.com/secondarydomain/wp-admin/" which makes NO sense. Also, if I manually type "maindomain.com/secondary/wp-admin/", it does allow me to see the administrative area of "secondarydomain.com".
    9. I thought that the fix might be to change the 'define('DOMAIN_CURRENT_SITE'...) line to what was recommended by chrisbrocklesby, but that had no effect.

    Can anybody help me with this?

  12. praeix
    Member
    Posted 3 years ago #

    Sorry it took so long for me to get back on this post, but my issue was caused by me forgetting to add a line from the code that needs to go into your wp-config.php file.

    From the codex, make sure to follow these steps exactly:

    0. First, back up your existing wp-config.php and .htaccess files. 1. Create a blogs.dir directory under /wp-content/ This directory is used to stored uploaded media for your additional sites and must be writable by the web server. They should be CHOWNed and CHMODed the same as your wp-content directory.
    2. Add the extra lines your WordPress installation generates into your wp-config.php file. These lines are dynamically generated for you based on your configuration. Edit the wp-config.php file while you are logged in to your sites admin panel. Paste the generated lines immediately above /* That's all, stop editing! Happy blogging. */.
    3. Add the generated mod_rewrite rules to your .htaccess file, replacing other WordPress rules. (If there isn't one, then create it.) These lines are dynamically generated for you based on your configuration.
    4. Log in again. Once the above steps are completed and the new wp-config.php & .htaccess files are saved, your network is enabled and configured. You will have to log in again. click "Log In" to refresh your Adminstration Panel. If you have problems logging back in, please clear your browser's cache and cookies.

  13. Nerx
    Member
    Posted 3 years ago #

    Add: define('NOBLOGREDIRECT', 'http://example.com'); to wp-comfig.php!

Topic Closed

This topic has been closed to new replies.

About this Topic