In search of a more userfriendly & search engine friendly urls, i want have beautied my urls: The htacces apache rule that achieves this (Thanks to Laurence Gonsalves)
RewriteRule ^([a-z][a-z])/(.*) /$2?ln=$1 [L]
which makes this possible:/uk/somepage
instead of /somepage?ln=uk
/de/somepage
instead of /somepage?ln=de
/ja/somepage
instead of /somepage?ln=ja
Now the difficult part: previously, the url was replaced with a normal link like href="?ln=de"
or href="?ln=it"
for changing language of the current page. But now how can i achieve that? Sothat the current page stays the same, but only the preceding two lowercase letters that say to the browser what language it is in change?
So how to tell the link to only change the /uk/contact
to /de/contact
once the german (de) language flag is clicked? php solution to rewrite the url or htaccess solutions are accepted.
I found out that $_SERVER['REQUEST_URI']
will output /uk/somepage
but i cant write the php code that can split up the components, add a new language code like "de" into it, which i can put manually into a normal href that goes on a German flag. etc. Thanks for any and all clues/answers!