Launching Your Translated Site Using Subfolders
Unlike subdomain or ccTLDs, language subfolders display translated content on your existing domain. For example, Canadian-French pages could appear at https://www.example.com/fr-ca/. Steps to launch a translated site using subfolders are as follows:
- Choose a language subfolder pattern.
- Configure your origin site with the proper source language pattern.
- Configure a host handler to detect language patterns in the URL and funnel translation requests to the proxy.
- Create a language selector.
Choose a Language Subfolder Pattern
Choose an appropriate subfolder pattern for each language. Use locales for more flexibility than language-only options. For example, using www.example.com/fr-fr/ is better than just using www.example.com/francais/ since you have the option to create a /fr-ca/ for Canada. Each locale must be different so that traffic can be routed properly. For example, the best practice when launching a Spanish version for the US would be to use /es-us/.
Configure the Origin to use a Source-Language Subfolder
Your origin website should use its source language locale for consistency and proper request routing. For example, if your source site is US English, all origin pages should be in the /us-en/ folder: www.example.com/us-en/index.html.
Configure the Host Handler
The host handler reads page requests and takes action on any URL pattern that matches the defined locale pattern. The host handler redirects the browser requests based on the requested language directory. Requests for the origin language pages are directed to the origin site while requests for translated pages are routed to the GlobalLink Web Proxy servers. You are responsible for the setup and maintenance of the host handler; however,Translations.com will assist with testing, and give final approval to any implementation. Here are some common host-handler options:
- A CDN (e.g. Akamai or Cloudflare)
- NGINX
- Apache using Mod_proxy
- F5 or Netscaler
GlobalLink Web Proxy with Host Handler
Requests routed to GlobalLink Web Proxy must have their host header set to the correct language host value. This value will be provided to you by your Implementation Manager and is typically in the format:
domain-lang.globallinkweb-translations.com
In addition to language subdirectories, some other subdirectories containing assets that are necessary for OneLink to operate also need to be mapped and pointed to the GlobalLink Web Proxy servers. These folders include but are not limited to the following:/pAckAgEs/
/OneLinkCHK/
/_onelink_/
/OneLinkTx/
/OneLinkOTX/
Please check with your Implementation Manager for more details.
Sample configuration using Apache withmod_proxy
RewriteEngine on # ------------------- # # www.example.com # # ------------------- # RewriteCond %{HTTP_HOST} www.example.com RewriteCond %{REQUEST_URI} /de-de/ RewriteRule .* - [E=HostOverride:example-dede.onelink-translations.com] RewriteCond %{HTTP_HOST} www.example.com RewriteCond %{REQUEST_URI} /fr-fr/ RewriteRule .* - [E=HostOverride:example-frfr.onelink-translations.com] RewriteCond %{HTTP_HOST} www.example.com RewriteCond %{REQUEST_URI} /ja-jp/ RewriteRule .* - [E=HostOverride:example-jajp.onelink-translations.com]
Sample Nginx Configuration
http { server { rewrite "^/_onelink_/(.*)" "https://jajp-prod-example.onelink-translations.com/_onelink_/$1"; rewrite "^/pAckAgEs/(.*)" "https://jajp-prod-example.onelink-translations.com/pAckAgEs/$1"; location /ja-jp/ { proxy_pass https://jajp-prod-example.onelink-translations.com/; proxy_set_header Host "jajp-prod-example.onelink-translations.com"; } } }
The last step is to configure the language selector. The process is similar to the steps described in Choose and Create a Language Selector, but instead of changing domains, you’ll switch to the target subfolder.
Sample Reverse Proxy Configurations
SSLProxyEngine on ProxyPass "/ja-jp" https://jajp-prod-example.onelink-translations.com ProxyPassReverse "/ja-jp" "http://jajp-prod-example.onelink-translations.com" ProxyPass "/_onelink_" "https://jajp-prod-example.onelink-translations.com/_onelink_" ProxyPassReverse "/_onelink_" "http://jajp-prod-example.onelink-translations.com/_onelink_" ProxyPass "/pAckAgEs" "https://jajp-prod-example.onelink-translations.com/pAckAgEs" ProxyPassReverse "/pAckAgEs" "http://jajp-prod-example.onelink-translations.com/pAckAgEs"