WordPress.org

Ready to get started?Download WordPress

Forums

Edit a site path in multisite for multilingual config and redirect. (6 posts)

  1. MrHoneyfoot
    Member
    Posted 1 year ago #

    I want to implement a redirect (based on browser language settings) via the index.php in root. To either my English language site or my Chinese site. My multisite is configured to use subfolders, not subdomains. So one would be "/en" and one "/zh". I plan to create a third site, on "/", where the index.php will detect browser language then redirect (code here).

    The problem is I already have a site on root URL (the English one). How do I safely modify the path to the existing site (from "/" to "/en")? I can't believe editing the path alone will work (the path setting in "wp-admin/network/sites.php"). Am I wrong? (It's a live site so I'd rather not experiment without more information.)

    Do I also need to edit the database and wp-config.php? Or htaccess?

    To complicate things: my multisite installation is in a sub-folder. Htaccess in root has a rewrite base to the subfolder. Should this stay the same, since it's my core multisite?

  2. MrHoneyfoot
    Member
    Posted 1 year ago #

    In fact, I can't edit the path (from "/" to "/en"). It's not an option. Unlike my other site, where I can do this from the "wp-admin/network/site-info.php?id=2" page.

    Is it impossible to edit path for the site with "id=1"?

  3. MrHoneyfoot
    Member
    Posted 1 year ago #

    Or is it impossible to edit "id=1" because I hard coded a url into wp-config? Like so:

    define('DOMAIN_CURRENT_SITE', 'www.example.com');

  4. The problem is I already have a site on root URL (the English one). How do I safely modify the path to the existing site (from "/" to "/en")? I can't believe editing the path alone will work (the path setting in "wp-admin/network/sites.php"). Am I wrong? (It's a live site so I'd rather not experiment without more information.)

    No editing that would be bad. :)

    The easiest thing would be to make a new site called EN and port the posts over.

    Baring that, you CAN switch out sites. I explain how in http://halfelf.org/ebooks/wordpress-multisite-110/ (it's on page 81 I think). The ebook is pay what you want. :)

  5. MrHoneyfoot
    Member
    Posted 1 year ago #

    Thanks for the recommendation :)

    As it was, I went ahead and set different primary site, then modified the paths in several database tables and wp-config. Incredibly, it worked.

    This saved me from porting. Which last time cost me a day to complete.

    The problem now is the code to detect browser language then redirect (code here).

    It throws up internal server errors :(

  6. What errors?

Topic Closed

This topic has been closed to new replies.

About this Topic