Not Solved index.php redirect
#1
Not Solved
Hello,

My site is suffering from "Pagerank Leak" - www.myurl.com/index.php has a higher pr than www.myurl.com.

Is it possible that, if a user enters the site via www.myurl.com/index.php for them to be redirected to www.myurl.com?

Thanks Smile
Reply
#2
Not Solved
Try to edit you .htaccess
add

Redirect /index.htm http://your_domain.com/

or
Redirect permanent /index.htm http://your_domain.com/



regards
Reply
#3
Not Solved
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.
Reply
#4
Not Solved
header("Location:http://www.myurl.com/"); in your file Smile
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 ^^
Reply
#5
Not Solved
I tried the code, but when I go to index.php it dosen't redirect to the homepage Sad
Reply
#6
Not Solved
try this then.

if(stristr($_SERVER['REQUEST_URI'], "index.php")) { header("Location:http://www.myurl.com/"); exit; }

however, works for me. Smile
Reply
#7
Not Solved
Sorry if this is a stupid question, but what's the difference? Aren't they the same thing...?
jsoltesz.com - MyBB lead designer & team member since 2006
Reply
#8
Not Solved
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 Smile
Reply
#9
Not Solved
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
Reply
#10
Not Solved
No problem, happy to help Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)