1. Check if the "change Language" option was POSTED.
2. If yes, then get the current URL
3. Modify the current URL to the other language equivalent
4. Do a header redirect to the new URL
following that I came up with the following codes and I am stuck on number 3 which I need help on.
Code: Select all
1. CHECK IF THE "change Language" OPTION WAS POSTED.
<a href="index.html?lang=en"><img src="images/en.png" /></a>
<a href="index.html?lang=de"><img src="images/de.png" /></a>
2. IF YES, THEN GET THE CURRENT URL
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
3. MODIFY THE CURRENT URL TO THE OTHER LANGUAGE EQUIVALENT
I am stuck here. please help me how can i modify the currentURL to the other equivalent. I have hundreds of pages and i am clueless really.
4. Do a header redirect to the new URL
<?php
header("Location: http://mygerman site/");
exit();
?>