pfkdesign Posted August 13, 2009 Share Posted August 13, 2009 hi everybody, I'm developing a web site and i used htacces to generate url friendly, the web site is multilingual and i have problem to changing the language; ex. url : http://www.example.com/en/news/ or http://www.example.com/en/contents/21/some-contents/ now i want to change the language to deand the url must looks like: url : http://www.example.com/de/news/ or http://www.example.com/de/contents/21/some-contents/ .... on the page i have a menu with flags to change the language but i'm redirecting to root, i want to stay on that page and only change the language of that page, (not redirecting to root) any idea? thank you in advanced. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted August 13, 2009 Share Posted August 13, 2009 I'm not sure the variables, can't be arsed to look them up but you can do this.. if $lang = "de" header(Location: $_SERVER['SERVER_NAME'].'/de/'.$PATH.'/') else if $lang = "en" header(Location: $_SERVER['SERVER_NAME'].'/en/'.$PATH.'/') like that, you'll have to find out the $path $_SERVER var.. if there is one.. You can also simply use str_replace/regex to replace '/en/' in the href.. not too hard. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.