I'm using multisite WordPress and qTranslateX plugin. My default website is in Bahasa and my second language is English. When I use custom link in mode language English like mydomain.com/multisite, it always added by "en" after mydomain.com, it will be mydomain.com/en/multisite. That link always return 404 because there is no page.
I want to use .htaccess to rewrite URL form mydomain.com/en/multisite to mydomain.com/multisite/en .
Thanks in advance
Unfortunately, you can't achieve that with mod_rewrite alone as far as I know. Wordpress will look at the REQUEST_URI to figure out what to show, and that one won't be overwritten (and
[E=REQUEST_URI:...]
will make it$_SERVER["REDIRECT_REDIRECT_REQUEST_URI"]
).If mod_proxy is installed as well, you could do something like this:
RewriteEngine On RewriteBase / RewriteRule ^en/([^/]+)(/?.*)$ /$1/en$2 [P,L]
It will proxy the request internally on the same host and server. Requesting http://example.org/en/test will look to wordpress as if http://example.org/test/en was requested.
Give it a try. If mod_proxy isn't installed, it won't work (and render a 404 for the URL), but it won't break your site, so it's pretty safe to experiment with.