A blog that makes you think

How to Setup WordPress Multilingual Multisite with Subdirectories

This is a technical post about WordPress. If it’s not your cup of Chai, feel free to skip it. Let me begin by saying that WordPress is the best platform for blogs and websites today. The functionality that it offers is unparalleled and I am very glad that I chose WordPress for my website. I…

This is a technical post about WordPress. If it’s not your cup of Chai, feel free to skip it. Let me begin by saying that WordPress is the best platform for blogs and websites today. The functionality that it offers is unparalleled and I am very glad that I chose WordPress for my website.

I started this website in 2015. Before that I was writing a blog in Marathi for about 8 years on Blogger. I closed it in 2017.

Now I wanted to start that blog again on my website. How do I do it? There are several options.

Most people go for a plug-in like Polylang for multilingual blogs. This is great for businesses where every post in English is translated into say Italian, for the Italian website. In my case, not more than 10 posts are translations, rest are independent posts. As far as I know, Polylang does not allow stand alone posts that are not translations.

Next option is to create a separate domain like mr.mysite.com This is not advisable because it is time consuming and expensive. You have to pay for extra server costs, dedicated IP and manage two separate WordPress admin accounts.

The third option is the best and this is why I love WordPress. It allows you to install a separate domain in a sub directory. So mysite.com/mr is a separate domain but it runs on the SAME WordPress installation so you can run it from the original admin account. No extra server costs.

There is only one problem. This can be done only for installations that are less than a month old. Why? Because there is a good chance that the new domain permalinks will clash with old ones. So if you have a post on parent site as mysite.com/testing and your new domain is mysite.com/testing it will create a conflict.

There is a workaround and it is advised to use it only if you are sure that there will be no conflict. In my case, the new website was going to have permalinks in Marathi so I was quite sure this will not be a problem. So here’s what I did.

Take backups of the whole site and of wp-config.php and .htaccess

Open wp-config.php in a text editor and look for the line

/* That’s all, stop editing! Happy blogging. */

Just above that add this line

define( ‘WP_ALLOW_MULTISITE’, true ) ;

Load Network admin dashboard, go to Tools>Network Setup

Fill in the details of your new site and click Install.

You will see two snippets of codes to be inserted in wp-config.php and .htaccess. Search for the line

define(‘SUBDOMAIN_INSTALL’, true)

Change the ‘true’ to ‘false’ and insert the codes.

If all goes well, you will now see a Network admin dashboard where you can add sites.

There is one more snag. WordPress wants to make sure that you don’t accidentally destroy the permalinks structure so it adds a /blog slug to your permalinks in the old website. You can go to Settings>Permalinks and remove it.

This is not a standard practice and things may go wrong. Follow this only if you are sure that your website permalinks are not going to have conflicts.

After about a month of research and testing, I was able to get my blog in Marathi up and running at rajksite.com/mr

What’s great about WordPress is now I can add more sites and run them on the same WordPress installation.

My plan for the next decade?

rajksite.com/it
rajksite.com/ja

Learn languages, master them, write in them. Create a Multilingual, Multicultural website 😀