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
two.example
three.example
After Network installation I've got a main site on a root domain, which is example
, but it switches to example/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/core/wp-admin/
which is correct. But when I go to network admin, it switches to example/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
. It's frontend works. When I try to access the backend, it goes to one.example/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/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:
- main network site
- main network site admin
- network admin
- some network site
- some network site admin
Here's my current site config for Nginx:
server {
listen 80;
server_name example *.example;
root /var/www/example/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!
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
two.example
three.example
After Network installation I've got a main site on a root domain, which is example
, but it switches to example/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/core/wp-admin/
which is correct. But when I go to network admin, it switches to example/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
. It's frontend works. When I try to access the backend, it goes to one.example/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/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 - main network site
http://example/core/wp-admin - main network site admin
http://example/core/wp-admin/network - network admin
http://one.example - some network site
http://one.example/core/wp-admin - some network site admin
Here's my current site config for Nginx:
server {
listen 80;
server_name example *.example;
root /var/www/example/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!
Share Improve this question asked Jul 31, 2014 at 11:00 Ihor VorotnovIhor Vorotnov 1,0352 gold badges9 silver badges21 bronze badges1 Answer
Reset to default 2It 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