The only problem is that MyBB uses the file for a few things like collapsing forum categories, if I redirect them it causes a lot of problems. I tried it once and it put the system in an endless loop of redirection.
header("Location:http://www.myurl.com/"); in your file
ops I missunderstood. however you could do an ugly hack.
if($_SERVER['REQUEST_URI'] == "index.php") { header("Location:http://www.myurl.com/"); exit; }
However only works if the request_uri is on the main domain. like myurl.com/new doesen't work on the code I posted.
ooh then you can just do
if($_SERVER['REQUEST_URI'] == "new/index.php") { header("Location:http://www.myurl.com/"); exit; }
or something ^^
I tried the code, but when I go to index.php it dosen't redirect to the homepage
try this then.
if(stristr($_SERVER['REQUEST_URI'], "index.php")) { header("Location:http://www.myurl.com/"); exit; }
however, works for me.
Sorry if this is a stupid question, but what's the difference? Aren't they the same thing...?
no, stristr searchs for index.php in the requested uri, however, the first one just checks if request uri is index.php.
and if that doesen't work you can always change stristr to strripos
CraKteR: Thank you very much!
The second snippet you posted works fine.
Thanks again!
Belloman: For some reason,
www.myurl.com/index.php has a PR of 5 and
www.myurl.com has a PR of 4. I'm trying to have the PR5 on the main URL. Hopefully this will prevent people linking to index.php, plus Google should notice the redirect
No problem, happy to help