0

I'm usually running WP on Nginx + PHP-FPM in a sub-directory (similar to Mark Jaquith's Skeleton) without any issues, all permalinks are working just fine. Now I tried to do this with WordPress Multisite and got some problems.

My wp-config.php settings:

// Give WordPress it's own directory
define( 'WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/core' );
define( 'WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] );

// Use custom content directory
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/content' );

In the filesystem it looks like this:

content/ - wp-content direcotry
    index.php
    languages/
    plugins/
    themes/
core/ - wordpress directory
    index.php
    wp-admin/
    wp-content/ - original folder, emppty
    wp-includes/
    ... - other wp core files
index.php
wp-config.php

With Multisite I want to have subdomain sites, like:

one.example.com
two.example.com
three.example.com

After Network installation I've got a main site on a root domain, which is example.com, but it switches to example.com/core, which is not what I need. How to remove this /core/ part from the main site frontend?

Next, when I go to main site admin, it opens via example.com/core/wp-admin/ which is correct. But when I go to network admin, it switches to example.com/wp-admin/network/ and shows 'Not found'. If I manually add /core/ part in the ulr, it works. How to add /core/ part to Network Admin?

Next, the problem with network sites. With some hacking of html source via Firebug I created one.example.com. It's frontend works. When I try to access the backend, it goes to one.example.com/wp-admin (which is wrong, missing /core/ part) and browser says 'The page isn't redirecting properly'. If I manually add the /core/ part and open one.example.com/core/wp-admin/ it shows the admin page but the styles and scripts are missing, of course. How to get subdomains admin working?

To further clarify, the correct working urls should be:

http://example.com - main network site
http://example.com/core/wp-admin - main network site admin
http://example.com/core/wp-admin/network - network admin
http://one.example.com - some network site
http://one.example.com/core/wp-admin - some network site admin

Here's my current site config for Nginx:

server {

    listen 80;
    server_name example.com *.example.com;
    root /var/www/example.com/httpdocs;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

}

This config works fine with regular, single-site WordPress install, when WP is installed in /core/ dir. I've removed all multisite-specific Nginx rules to be able to start from scratch.

I've checked dozens of support topics, Stackoverflow / Stackexchange questions, Nginx forums etc. Tried different configs - couldn't get it running.

Thanks ahead for any hints and help!

2

It sounds like it's not possible with stock WordPress Multisite to have a subdomain network from a WordPress-in-a-subdirectory installation:

WordPress must run from the root of your webfolder (i.e. public_html) for subdomains to work correctly. They will not work from within a subdirectory.
-- Before You Create a Network

  • Yes, you're right. Will have to switch to subdirectory multisite setup. – Ihor Vorotnov Aug 1 '14 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.