Hello. I am trying to get the correct code in order to get specific content shown according to the current site the visitor is on.
I have done two tests:
<!--START TEST 1-->
<?php
class address
{
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;
}
}
$current = new address;
$current->curPageURL();
$address2 = "http://www.mydomain.com/travel/hotels/jaco";
if($current == $address2) {
echo "HELLO WORLD!";
}
?>
<!--END TEST 1-->
<!--START TEST 2-->
<?php
$address = $_SERVER['REQUEST_URI'];
$address2 = "http://www.mydomain.com/travel/hotels/jaco";
if($address == $address2) {
echo "HELLO WORLD!";
}
?>
<!--END TEST 2-->
By the way, on my .htaccess I have some rewrite rules, for example:
RewriteRule ^hotels/jaco$ index.php?p=1&q=jaco®ion=1
The working directory is /travel
Please, any help would be greatly appreciated.
Kind regards.