The MU forums have moved to

Aliased domains: Making it work (3 posts)

  1. adamrbrown
    Posted 17 years ago #

    I have an aliased domain (ALIASDOMAIN.COM) that refers to a subdirectory of my main domain (MYDOMAIN.COM/ALIAS/). When I tried installing MU into ALIASDOMAIN.COM/BLOGS/, this caused all sorts of problems. I searched these forums and found many folks who had experienced the same problem but none who had found a solution. Well, after a couple hours, I got it to work. This will be a pretty vague solution. Perhaps somebody with more time on their hands would like to modify the installer to eliminate the problem.

    The problem is this: when index_install.php tries to find absolute URLs, it uses dirname(whatever). When you use an aliased domain, this causes all sorts of problems. You need to go into index_install.php and search for every instance of dirname and replace it with one of the following:

    If you find dirname($_SERVER[SCRIPT_NAME]), or something similar, change that to "/" (or "/blogs/" if you've installed to If you find dirname(___FILE___), change that to the absolute path to your installation, in quotation marks, minus the trailing slash (e.g. "/home/content/html/blogs").

    A confusing instance is this line:
    $url = stripslashes( "http://".$_SERVER["SERVER_NAME"] . dirname( $_SERVER[ "SCRIPT_NAME" ] ) );
    Replace it with
    $url = stripslashes( "");
    or, if you've installed into a directory called "blogs",
    $url = stripslashes( "";

    These problems could all be avoided if the install screen simply asked you to input your URL and absolute path instead of trying to figure paths out on its own in index_install.php. For most users, these fields could be filled in automatically. But for folks using an alias, and especially an alias with a subdirectory appended, having the opportunity to define these settings manually could be a lifesaver.

    One more thing. You'll also need to edit wp_config_sample.php and find this line:
    define('ABSPATH', dirname(__FILE__).'/');
    and change it to
    define('ABSPATH', "/home/content/html/blogs/");
    or whatever your absolute path is, including a trailing slash.

  2. adamrbrown
    Posted 17 years ago #

    Okay, only one problem. These changes got the installation to work correctly, and I can view the installation without getting into an infinite redirect (these were problems before I made the above changes). But something's wrong with the htaccess that was autogenerated that I can't quite figure out. I can view posts using GET queries, but not with the permalinks. Any ideas?

  3. adamrbrown
    Posted 17 years ago #

    To make sure it's clear: I know that mod_rewrite works, since I use Wordpress (not MU) elsewhere on my site already. I'm getting a "Bad Request" error (a 400 error): "Your browser sent a request that this server could not understand."

About this Topic

  • Started 17 years ago by adamrbrown
  • Latest reply from adamrbrown