• 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)

    • This topic was modified 3 years, 9 months ago by hardfire.
    • This topic was modified 3 years, 9 months ago by hardfire.
Viewing 2 replies - 1 through 2 (of 2 total)
  • And here I was thinking I was the only one who loves pain when it comes to technical solutions.

    Why this rather convoluted setup?

    Any reason you can’t simplify things and and save yourself from all these trouble? Any reason you can’t move the network to the root have the single WordPress site be the primary network site?

    Thread Starter hardfire

    (@hardfire)

    ?? Thankyou for pointing out the obvious explanation that i should’ve given. The reason to not convert the root WordPress site to a network has more non-technical than technical reasons. Its the thing that works and generates money for the company and we want to go the “don’t change a working system” route to test with the network.

    Worst case scenario, the network is not there after some months. That is why we want to do the setup in this way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multisite URL redirect via htaccess’ is closed to new replies.