Support » Plugin: Transposh WordPress Translation » Redirect /?lang=xx to seo friendly /xx/ format

  • Resolved rtwood


    I have switched my urls from the ?lang=xx to the seo friendly /xx/ format. However, I want to automatically 301 redirect any visitors that go to the old /?lang=xx to the new /xx/ url.

    Canonical is already in the code but I would like the visitors to go to the new seo friendly language page automatically.

    I have searched all over the internet for a ?lang=xx to /xx/ htaccess rule but cannot find it. If you can help me I would greatly appreciate it.

    Thanks in advance.

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

    Plugin Author Ofer Wald



    Care to share your solution?


    Hi Ofer,

    I was able to add code to my htaccess file to get it to work. It may not be the best method, but it works great so far.

    I added this to the very beginning of my .htaccess file. It is important that it is at the top of your htaccess (or before wordpress permalink rewrite code)

    <IfModule mod_rewrite.c>
    RewriteCond %{QUERY_STRING} ^(.*)lang=([a-z]{2})&?(.*)$
    RewriteRule (.*) /%2/$1?%1%3 [R=301,L]
    Plugin Author Ofer Wald


    Thanks for sharing 🙂

    You are probably missing the Chinese of Taiwan variant (zh-tw) language in the redirect, but I guess it is not really that important

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Redirect /?lang=xx to seo friendly /xx/ format’ is closed to new replies.