Support » Networking WordPress » Site Network: Automatically redirecting from other parts of site

  • Resolved Darklyte


    I’ll start with a summary of my problem. I recently enabled WordPress Site Network with 3.0. Since then, I have not been able to access my mediawiki as I am redirected to the blog.


    Here is what happened. Originally, my blog was installed at I wanted to find a way to be able to filter posts easily based on simple urls and it seemed like the site network feature was the answer. After a while I got it working, but it insisted I use for my urls which I did not want. I struggled a bit to fix it, eventually settling on doing a complete reinstall in my root directory /public_html/. I linked it with the previous database and it worked all right. I had decided, however, that instead of using subdomains for my multiple blogs I wanted to use sub-directories. I found a hack that allowed me to do this by adding a line of code to the header of my currently enabled them. I then installed wordpress as a network and everything was fine.

    Since then, whenever I try to access the wiki I get redirected back to the base blog at If I disable the following line in my wp-config.php, I can access the wiki but my blogs go back to single-mode:

    define( ‘MULTISITE’, true );

    Is there something I need to do to be able to access my wiki as well as my blogs?

Viewing 9 replies - 1 through 9 (of 9 total)
  • I had decided, however, that instead of using subdomains for my multiple blogs I wanted to use sub-directories. I found a hack that allowed me to do this by adding a line of code to the header of my currently enabled them.

    Woooah, why?

    Disable whatever you hacked in there to redirect, seriously. There’s a built in way to do this.

    Have this in your wp-config.php file:

    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );

    That turns on MultiSite and turns OFF SubDomains.

    It wasn’t a complicated hack, it just made it so it spit out the proper .htaccess code for the subdirectory install. Here is what was added to functions.php:

    add_filter( 'allow_subdirectory_install',
    	create_function( '', 'return true;' )

    This is what multisite had me add to wp-config:

    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', false );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', '' );
    define( 'PATH_CURRENT_SITE', '/' );
    define( 'SITE_ID_CURRENT_SITE', 1 );
    define( 'BLOG_ID_CURRENT_SITE', 1 );

    And this is the .htaccess code put in the root directory, where wordpress is installed:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule  ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # END WordPress

    It is much different than the subdomain information. The hack I added merely allowed wordpress to install using subdirectories since my database is over 30 days old. Sorry for the confusion.

    I’ve tried blanking the .htaccess to see if that fixes the issue, but it doesn’t. It seems to only redirect from that wiki as well. still works.

    It wouldn’t be the .htaccess at this point, or rather, it shouldn’t be. You can restore that.

    Is there an .htaccess in the wiki folder?

    I checked and does NOT redirect, so somewhere in the setup of the wiki subdomain, it’s pointing to a weird place.

    Here is the htaccess in the wiki directory:

    RewriteEngine On
    RewriteRule ^w/(.*)$ /wiki/index.php?title=$1 [PT,L,QSA]
    RewriteRule ^w/*$ /wiki/index.php [L,QSA]
    RewriteRule ^/*$ /wiki/index.php [L,QSA]

    It changes it so instead of being it shows in the browser as It also lets you use to navigate around.

    I tried blanking that .htaccess. And it gives a 500 error. Maybe that htaccess is somehow directing it to the wordpress index.php mistakenly?

    That looks okay (I had a very similar setup until recently).

    When you set up the subdomain for the wiki, you specified it points to folder? (I’ve never tried it that way, personally, I always use a subdomain folder of the same name – so ‘wiki’ for wiki and so on…).

    Oh no, sorry. A friend of mine asked me if I could set up a mediawiki for her so that is a separate installation. The only wiki that isn’t working is the subdomain install at

    Okay well, apparently I must have really screwed something up. works, but all of its subdirectories give 500 errors :/ I must have seriously screwed something up.

    Ah, that makes more sense.

    Okay. Did you change any file permissions when you uploaded WordPress?

    Also having a files folder on your server may cause weird things to happen with MultiSite (remember means there’s a folder so you actually have as well) – Why? Because WordPress MultiSite uses the .htaccess to parse the files ‘folder’ as a virtual folder, where it stores your uploaded images.

    Go through your WHOLE wp-config.php and make sure that there’s no lingering define( 'SUBDOMAIN_INSTALL', true ); in there.

    You didn’t do anything to subdomains in general, did you? Like adding a wildcard dns alias?

    Nope, changed nothing. Awesome news however, I FINALLY solved the problem.

    First the for files. Apparently since I have my subdomain named files the .htaccess in my root directory was rewriting any attempt to access anything in that directory to essentially point it no where. The line that was causing the error was:

    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    Since this .htaccess is in the root directory is cascades into the subdirectories and thus the subdomain. How did I fix this? It was as simple as adding this line to the .htaccess in /files/

    RewriteEngine off

    For the redirecting issue I was at a lost. I figured there must have been some hook that was redirecting my mediawiki’s index.php back to wordpress’ index.php. I tried renaming it to wiki.php and noted that it did NOT redirect then. So I backed up the file and started deleting lines until I found the one that I could remove to stop the redirect. After going through a few more files it came to localsetting.php, the main configuration file for mediawiki. In this file it was the inclusion of the firestats extension (plugin). I can easily disable this extension without losing anything. I believe the problem had to do with firestats actually having a directory called /php.

    Success! Thanks for your help. You definitely helped me narrow it down.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Site Network: Automatically redirecting from other parts of site’ is closed to new replies.