Multisite sub-site login
-
I set up WP v3.6.1 and ensured the primary site works.
I then got multisite going by following the instructions at WP Codex. I then set up a subsite and ensured it works. When I try to log into the subsite by going to:
example.com/subsite/wp-login.php
the log in succeeds, but URL changes to:
example.com/wp-admin/user/and doesn’t let me do anything (only options are now Dashboard and Profile). I can change the URL to:
example.com/subsite/wp-admin/and this works, but shouldn’t be necessary.
Notes:
– I tried adding:AllowOverride All
to .htaccess. This produces Internal Server errors.
– I found suggestions for what appeared to be a related issue, so I added:define('ADMIN_COOKIE_PATH', '/'); define('COOKIE_DOMAIN', ''); define('COOKIEPATH', ''); define('SITECOOKIEPATH', '');to wp-config.php. Didn’t help.
Any suggestions are appreciated.
Cheers!
Dirk
-
Please use CODE tags (see the edit bar above the text box here 😉 ) not em when showing code.
What plugins are you running on the network?
(Apologies for not using CODE tags; not familiar yet with what does what here.)
So far, base WP 3.6.1 install, only stock plugins installed and none enabled.
When I get the base multi-site stuff working, I’ll be adding domain mapping (subsites will have their own domain names).
If it’s of value, I’d be happy to post wp-config.php and .htaccess.
Thanks for your response, Mika.
Cheers!
DirkThere’s nothing in core WP to redirect you to example.com/wp-admin/user/…. Unless you’re not logging in as the superadmin maybe?
When I log into WP console (/wp-admin) as a user with only subscriber role, that is what happens to me… I get redirected to /wp-admin/user
You must not be logging in as the admin/super-admin
I don’t (yet) understand the mechanics of how WP redirects anything, so won’t speculate on what does what.
I’m logging in as a subsite user (administrator) into the subsite at:
example.com/subsite/wp-login.php
(User was specified when creating the subsite.) Site URL then changes to:
example.com/wp-admin/user/
instead of:
example.com/subsite/wp-admin/Superadmin log in works fine (everything on the primary site works as expected).
I can’t imagine anything in wp-config.php would be contributing to this (I’ve added all the code as directed by the two-step multisite enabling process). However, perhaps the same multisite enabling process’ revisions to .htaccess are making a difference. Here is its content:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [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] </IfModule> # END WordPress(Hope I got the CODE bits right this time. %-} )
Note: I do not have a solid grasp on how .htaccess works either. Suggestions on things to try are most welcome.
Cheers!
DirkMy guess is that you did not create your subsite admin user properly – probably didnt assign that user the ‘Administrator’ role.
This is what I would try:
1) log in as a Network Admin user
2) look at the subsite user list – http://<domain.com>/<subsite>/wp-admin/users.phpYour subsite admin user should be displayed on that list with ‘Administrator’ role
I logged in as superadmin into the primary site, listed all sites, entered the Dashboard of the subsite, and subsite user has role of Administrator.
I logged out of the primary site and then logged in as user of subsite via
example.com/subsite/wp-login.php, made the (problematic) URL update toexample.com/subsite/wp-admin/, went to Users. User has the Administrator role.I then re-logged in as superadmin, changed the subsite user’s role to Editor and get exactly the same results. It appears that a subsite user’s role is not the culprit. (I checked and the capabilities change appropriately for the subsite user when switching between Administrator and Editor roles, but the problematic URL change happens in either case.)
Cheers!
DirkPS I thought perhaps cookies were somehow involved, so cleared all cookies for this site, and get the same results.
I am stumped. I do not think it is an .htaccess problem. My first guess is plugin, but you say you do not have any plugins enabled. Here are my custom settings in wp-config.php
define( 'WP_ALLOW_MULTISITE', true); define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'domain.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); define('SUNRISE', 'on');/wp-admin/user/ is the User Admin menu. I have never been redirected to that url, though subscriber roles who try to access /wp-admin get the content of /wp-admin/user/
Thank you, jkhongusc.
I’ve done a complete re-install of everything:
– removed all DB tables
– removed all software
– uploaded freshly unzipped WP 3.6.1
– applied multisite process
– added one subsite
Nothing else..htaccess contents:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [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] </IfModule> # END WordPresswp-config.php contents:
define('DB_NAME', 'db'); define('DB_USER', 'db'); define('DB_PASSWORD', 'dbpassword'); define('DB_HOST', 'localhost'); define('DB_CHARSET', 'utf8'); define('DB_COLLATE', ''); // AUTH_KEY to NONCE_SALT were updated for this new install but // left out of this post as it was messing up its display $table_prefix = '_'; define('WPLANG', ''); define('WP_DEBUG', true); // multi-site insertions define('WP_ALLOW_MULTISITE', true); define('MULTISITE', true); define('SUBDOMAIN_INSTALL', false); define('DOMAIN_CURRENT_SITE', 'example.com'); define('PATH_CURRENT_SITE', '/'); define('SITE_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1); if ( !defined('ABSPATH') ) define('ABSPATH', dirname(__FILE__) . '/'); require_once(ABSPATH . 'wp-settings.php');Set up subsite and verified that the subsite user has the Administrator role and has proper access to the subsite once logged in and URL is changed.
Problem continues. 😐
Note: You mention that users with the Subscriber role get redirected to
wp-admin/user/. I get this with a subsite user with the Administrator or Editor role, even though they have appropriate access once I manually update the URL fromwp-admin/user/tosubsite/wp-admin/.I’m convinced this has something to do with how WP manages redirection and that likely collides with something in .htaccess.
Cheers!
DirkAddendum: Hadn’t noticed this before, but if I log in as superadmin to the subsite by going to:
example.com/subsite/wp-login.php
it takes me to the Dashboard for the subsite:
example.com/subsite/wp-admin/So, logging into subsites works properly for superadmin users, but not subsite users. 😐
I am using WP 3.6.1 sub-directory and my configurations (htaccess and wp-config.php) are almost exactly the same as yours. I even created a subsite admin on my subsite and tried logging in… I got redirected to the proper url – /subsite/wp-admin/
Last question are you using a real hostname for your site? Not something like an IP address or ‘localhost’?
Real hostname on a cPanel account at a shared hosting provider. You can see the actual site at:
wp.pagestep.com
Subsite at:
wp.pagestep.com/subsiteI have had no issues with independent WP sites on the same host (I’m getting more WP requests from new clients, so want to have a single WP install instead of having to deal with multiple WP sites every time an update comes out).
Thanks for your ongoing efforts, jkhongusc!
Cheers!
DirkI have reproduced the problem exactly on a local development server (LAMP setup) which uses local domain names (not “localhost” or IPs).
Not sure if this makes any difference: both the shared hosting and my local development server are running the suhosin Apache module.
Anyone (else) have suggestions?
Cheers!
DirkCan you disable suhosin? Here is one way to disable it, by turning on simulation mode:
http://www.hardened-php.net/suhosin/configuration.html#suhosin.simulation
The topic ‘Multisite sub-site login’ is closed to new replies.