Multisite URL redirect via htaccess
-
Hello,
I have a WordPress site in the root (eg: example.com) and have a multisite installation in my network folder (eg: example.com/network with sites like example.com/network/uk and example.com/network/fr). I would like to setup htaccess in a way so that we can redirect to the websites without
network
in the URL. So i’d like example.com/uk to show pages in example.com/network/uk (without a 30x redirect, so using URL rewriting).I have the following in my root htaccess
RewriteRule ^uk$ /network/uk/ [L,NC] RewriteRule ^uk/(.*)$ /network/uk/$1 [L,NC]
and have set the site url for the uk site to example.com/uk
The website works well and now to the issue: After this setup, When I try to access the admin for uk site it goes into a redirect loop. After entering my credentials i am redirected to the login screen again with the error “Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”. I noticed that i set-cookie has the path as /network whereas because of the URL rewriting the website is now on /uk (and not /network/uk). What would be the best way to go around this issue?
Another thing i noticed, if i make the following change in wp-config
define('PATH_CURRENT_SITE', '/'); // was '/network/' before
the uk site works, but the network admin is not accessible anymore (because it wants to be accessed via example.com/wp-admin/network (where it doesn’t reside obviously)
- The topic ‘Multisite URL redirect via htaccess’ is closed to new replies.