Hi guys.
Hope you can help.
I created the below code to provide a few functions:
The below code is working perfectly, except in one instance.
If we have a URL like http://www.ourdomain.com/index.php?id=4 it unfortunately gets rewrote to http://www.ourdomain.com/index.php?id=4index.php (with index.php after the id). Any ideas on how to prevent this?
The code:
if (strpos ($_SERVER['HTTP_HOST'], 'www.') !== 0) {
if(preg_match("/\..{3,4}$/", $_SERVER['REQUEST_URI'])) {
header ('Location: http://www.ourdomain.com' . $_SERVER['REQUEST_URI']);
exit();
}else{
header ('Location: http://www.ourdomain.com' . $_SERVER['REQUEST_URI'].'index.php');
exit();
};
}else{
if(!preg_match("/\..{3,4}$/", $_SERVER['REQUEST_URI'])) {
header ('Location: http://www.ourdomain.com' . $_SERVER['REQUEST_URI'].'index.php');
exit();
};
};
Many thanks.