Title: Wrong URLs in multisite
Last modified: April 19, 2018

---

# Wrong URLs in multisite

 *  Resolved [Anastis Sourgoutsidis](https://wordpress.org/support/users/anastis/)
 * (@anastis)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/wrong-urls-in-multisite/)
 * When enabled in sub-site of a multisite installation, the generated URLs that
   include a language code are incorrect, causing 404s.
 * The generated URLs are like: [http://domain.com/installation/lang-code/subsite/page-slug/](http://domain.com/installation/lang-code/subsite/page-slug/)
   
   They should be like: [http://domain.com/installation/subsite/lang-code/page-slug/](http://domain.com/installation/subsite/lang-code/page-slug/)
 * Visiting the correct URL manually, works as it should.
 * Hopefully it’s an easy fix for you guys, because as it is now, it currently unusable
   for multisite installations.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Weglot Translate Team](https://wordpress.org/support/users/remyb92/)
 * (@remyb92)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/wrong-urls-in-multisite/#post-10199182)
 * Hello,
 * Ok I see, can you send me the website address and the URL to [support@weglot.com](https://wordpress.org/support/topic/wrong-urls-in-multisite/support@weglot.com?output_format=md)?
   So I can investigate what is making this in the URL.
 * Best
 *  Thread Starter [Anastis Sourgoutsidis](https://wordpress.org/support/users/anastis/)
 * (@anastis)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/wrong-urls-in-multisite/#post-10200485)
 * So, I debugged things a bit, and I think the problem is inside Weglot->replaceUrl()
 * There’s a loop `foreach ($this->network_paths as $np)` that seems to be handling
   exactly what doesn’t work on my installation.
 * The condition is always true for the first of the `$this->network_paths`. My 
   multisite installation is inside a directory, so it’s accessible like `http://
   localhost/preview/` and individual sites are `http://localhost/preview/site`
 * I guess your code expects the first element of `$this->network_paths` to be empty
   or up to 2 chars, therefore the `strlen($np) > 2` exists, but not all installations
   can go to the www root 🙂
 * I hope this screenshot of my IDE can help you: [https://www.dropbox.com/s/rs5dchk0h3kobjp/Screenshot%202018-04-20%2003.01.37.png?dl=0](https://www.dropbox.com/s/rs5dchk0h3kobjp/Screenshot%202018-04-20%2003.01.37.png?dl=0)
   
   Note that at the time of the screenshot the str_replace hasn’t run yet at all,
   and $urlTranslated is `/el/preview/olsen/contact/`. Once it runs, it becomes `/
   preview/el/olsen/contact/` which is still wrong, as it should be `/preview/olsen/
   el/contact/`.
 * Hope this helps a bit 🙂
 *  Plugin Author [Weglot Translate Team](https://wordpress.org/support/users/remyb92/)
 * (@remyb92)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/wrong-urls-in-multisite/#post-10202027)
 * Hi Anastis, I just sent you a message by email 🙂 Hope you received it
 *  [luxen18](https://wordpress.org/support/users/luxen18/)
 * (@luxen18)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/wrong-urls-in-multisite/#post-10453926)
 * Hello this translate shows on my booking form 404 page only need help

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Wrong URLs in multisite’ is closed to new replies.

 * ![](https://ps.w.org/weglot/assets/icon-256x256.gif?rev=3333666)
 * [Translate WordPress with Weglot - Multilingual AI Translation](https://wordpress.org/plugins/weglot/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/weglot/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/weglot/)
 * [Active Topics](https://wordpress.org/support/plugin/weglot/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/weglot/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/weglot/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [luxen18](https://wordpress.org/support/users/luxen18/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/wrong-urls-in-multisite/#post-10453926)
 * Status: resolved