Change site language in wordpress with Rewrite API (2 posts)

  1. Romeus
    Posted 2 years ago #

    I have a site on wordpress and want to make language switcher english/russian. I want to implement the next url scheme:

    Default (english) urls look like that: site.com/company
    Russian urls look like that: site.com/ru/company

    I want to make next programming handling: When url like site.com/ru/company comes to WP, I detect this situation and internally call page site.com/company with query string lang=ru for the appropriate handling this lang in page template file company.php.

    But I don't want to make external redirect (301) through the browser, and handle that situation internally.

    How to implement this scheme with Rewrite API ?

  2. Chris
    Posted 2 years ago #

    I would recommend using a Multisite installation instead or if you insist of only having a single wp instance go with a commercial plugin like WPML.

    WPML helps you keeping track when you want every page in every language you're offering. If you want to localize your site, meaning potentially having different or more targeted content for different countries/languages as well Multisite is the way to go.

Topic Closed

This topic has been closed to new replies.

About this Topic