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. Link to comment https://forums.phpfreaks.com/topic/170020-solved-language-change-and-seo-url-problem/ 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. Link to comment https://forums.phpfreaks.com/topic/170020-solved-language-change-and-seo-url-problem/#findComment-896953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.