This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.


This topic contains 1 reply, has 2 voices.

Last updated by Raja Mohammed 8 months, 1 week ago.

Assigned support staff: Raja Mohammed.

Author Posts
September 19, 2019 at 8:28 am #4602561


Hello everyone!

Although the code snippet outlined within this previous thread

appears to be a good fit for a website I'm managing, I still would like to ask you a couple of additional questions in this regard.

We have three language versions; after have changed the URL language format from

hidden link
hidden link


hidden link
hidden link

I'd like to redirect the former URL versions to the actual ones.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{QUERY_STRING} lang=en
# exclude all requests starting with /wp-admin/
RewriteCond %{REQUEST_URI} !^/wp-admin/.*$
RewriteRule ^(.*) /en/$1? [L,R=301]

1) As stated before, this code snippet apparently fits my situation. However, it is designed for lang=en only. How could I also include lang=ru in it?

2) "Please use this .htaccess content and put it above the current content for WordPress."

What this actually mean? Do I have to place this code snippet as the very first entry in the .htacces, above any other line of php-code?

Thank you in advance for any valuable hint!

September 20, 2019 at 11:31 am #4611743

Raja Mohammed

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello there,

Since you have mentioned the rewrite rule works for you just for English, in that case, I would suggest adding a regular expression match in lang and pass the expression to rewrite rule would solve your issue.

Alternatively, you can add another rule for other languages as you did for English.

Please refer to this URL for some clarification on how to handle them hidden link

Please also exclude wp-json as you did for wp-admin.

Since we dont have any redirect script ready, I would suggest sending this as a feature request so that changing from parameter URL to directory URL is handled by default in WPML core

I hope this helps you better.

Kind regards