Language Subdomains for SEO

Optimizing for SEO. For example: en.yourwebsite.com or es.yourwebsite.com

Subdomains Overview

Language subdomains enable you to promote your business using one domain name for all languages, with a separate subdomain for each language.

For example:

Using language subdomains to structure your multilingual site is a recommended best practice for optimizing SEO. We recommend setting up language subdomains for your website to optimize your website for search engines and to ensure that the translated versions of your website are appropriately indexed.

📘

Only 1 Copy of your Website Required!

Keep in mind that when using the subdomains method there is only 1 website, with the website translations being managed using the Localize dashboard. Based on the chosen language, the appropriate translations are automatically displayed in the user's browser, but they are all being served from the same website.

This eliminates the need for you to maintain multiple websites, but from Google's perspective they essentially ARE different websites, thus providing you with search results in the respective languages. This allows your users to search for and find your website in their native language.

Works Automatically

Our subdomain language detection works "out-of-the-box". What that means is if you have correctly configured DNS for a top level subdomain like "fr.localizejs.com", and the language "fr" is active in your project, the page will get translated to "fr" when a user visits the page, without having to switch the language themselves!

HREFLANG and Canonical Tags

To allow search engines to index the target language versions of your site separately from your source language version, you should add HREFLANG tags to all of your pages. Read more here...

You should also have the appropriate Canonical tag for each page. Read more here...

(see also Language Subdirectories)

Example: WordPress w/Subdomains

Using the Localize WordPress plugin, you can elect to use the subdomains method. Using this method, you will only have 1 copy of your WordPress site in your source language. All other target languages will be handled by Localize, so no need for multiple copies of your content!

However, in order to use subdomains you'll need to add the subdomains to your DNS settings, and do some setup on the server that hosts your WordPress site. Use the sample instructions below to set up your server. Since there are many types of servers and many types of setups, we can only provide samples of some of the more popular server types. Use these as a guide for your server.

1. Set up your DNS Records

You'll need to edit your DNS records to create a separate subdomain for each target language that you want to support. For each language, you will use the language code for the subdomain portion of the full domain name.

Let's assume that the source language version of your site is at: example.com, and you want to add a Spanish version of your site.
es is the language code for Spanish, so you would have es.example.com as the full domain name for the Spanish version of your site.

For each target language that you support, create a new CNAME record using your DNS manager.
For example, to add Spanish as a target language:

NameTypeContent
es (or es.example.com)CNAMEexample.com

Depending on how your DNS manager works, the syntax may vary slightly.

You could also use an A record if you prefer, which would point the target language subdirectory directly to the IP address of your site. The one disadvantage of this approach is if your IP address ever changes, you'll need to update all of your A records to point to the new IP.

2. Set up your Server

Every server setup is a bit different, and what your host provider allows you to do on the server is also different. Below are partial setup instructions for the Apache and NginX servers for setting up a Spanish (es) subdomain for your site. The main thing that you need to do is to create an alias to your current website.

📘

NOTE

This step may not be needed, depending on how your server is set up.

Apache

For an Apache server, you need to add a ServerAlias to your Virtual Host configuration file.

<VirtualHost *:80>
   ServerName example.com
   ServerAlias es.example.com
   ...
</VirtualHost>

<VirtualHost *:443>
   ServerName example.com
   ServerAlias es.example.com
   ...
</VirtualHost>

NginX

For an NginX server, you need to add a new server block for each new language.

server {
   server_name example.com;
   ...
}

server {
   server_name es.example.com;
   ...
}

3. Set up Localize in WordPress

You can follow the instructions here for installing the Localize WordPress plugin, and selecting the subdomain option.