get full url link with language prefix in wordpress

2.9k Views Asked by At

I want to get the language prefix from url with Wordpress, but I don't know how. if I have the following url http://sitename.com/ru/about-us, I want to get the full path including /ru/, but whatever I try i don't get it ,e.g

$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']

I am using qTranslate plugin, and my site it multilanguage

I just want to check if the url link has language prefix after host name, I can do that if i get the whole url, but I can't get it, anybody can help me?

2

There are 2 best solutions below

2
On

You can easily do that with Permalinks option from your WP dash board. Go to Settings > Permalinks. Select Custom Structure and add this line /ru/%postname%/.

0
On

This question seems similar to another one. The fix could be to install the following plugin:

http://wordpress.org/plugins/qtranslate-slug/

It should fix the URL problems that as it seems qTranslate has.

Reference: Keep the string prepended in request uri

If not working, you may want to try all other suggested code...