Modifying WordPress permalink structure


We have a website set-up at If you want to change languages, it will go to the same URL and append /?la=XX, where XX is the language code (en, es, nl, for example).

I want to change the permalinks, so:

- First of all, all old requests should have a 301 redirect to their new location, for example:

/company/ should go to /XX/company/

Where XX is the current language, this is set in a session variable, and if not set we'll use the default.

- Second of all, inside WordPress, all links should be modified. Right now, we have:


Which is a custom post. This should become not only /en/property/beautiful-villa/, but also throughout the site we need to change all links from /old/ to /current_language/old/.

Essentially, i'll want to go in the WordPress admin and simply change the permalinks from /%post_name%/ to /%lang_code/%post_name%/.

Really been breaking my brain over this full-time for the last 2 days. I've read a lot of stuff and have thoroughly checked WordPress's site but i just can't get it to work.

Can you give me an idea of how to do this, and possible an example?