Need if statement to check it 'www' exists in URL...
Posted: Tue Jan 06, 2009 10:10 am
On my website I use google maps API which will not work properly unless 'www' exists in the url. Some search engines index my site w/o www in the url. The website is http://www.NewYorkMustangs.com
This is what I have so far, which find the url, but doesnt let me input anything before /cururl.php, as you can see here: http://www.newyorkmustangs.com/cururl.php
<?php
$homepage = "/cururl.php";
$currentpage = $_SERVER['REQUEST_URI'];
if($homepage==$currentpage) {
echo "works";
}
?>
If i enter the entire URL as $homepage, it will not work. I think request_uri assumes everything before /cururl.php.
I basically need something to check if 'www' exists in the url, and if not, it will redirect to a different page.
Thank you very much!
This is what I have so far, which find the url, but doesnt let me input anything before /cururl.php, as you can see here: http://www.newyorkmustangs.com/cururl.php
<?php
$homepage = "/cururl.php";
$currentpage = $_SERVER['REQUEST_URI'];
if($homepage==$currentpage) {
echo "works";
}
?>
If i enter the entire URL as $homepage, it will not work. I think request_uri assumes everything before /cururl.php.
I basically need something to check if 'www' exists in the url, and if not, it will redirect to a different page.
Thank you very much!