Forum Moderators: coopster
My problem now.. is that after 301 redirecting various other domains that I've owned over the years: I've ended up with pages indexed in google that no longer look like tags but the actual folders they were redirected from (ie. domain.com/tag/folder1/folder2/index.html )
My solution - is that since tag/folder1/folder2/index.html is the same as search.php?q=folder1/folder2/index.html - I just need to 301 redirect the search page to the homepage when a slash is found in the Query field correct?
How do I do it!? Thanks!
if(strpos($_GET['q'],'/')!== FALSE) {
[url=http://www.php.net/header]header[/url]('Location: other_page.html');
exit();
}
Yes; if it finds a match it returns the position in the string (an integer value, including zero), however, if nothing is found, it returns FALSE. The condition is checking to see if something is found, or it is NOT (!==) FALSE, and if it's true, redirect the page.
Hope that explains it :)
if(strpos($_GET['q'],'/')!== FALSE) {
Header("HTTP/1.1 301 Moved Permanently");Header("Location: [domain.com...]
exit();
}
as I noticed it occasionally redirected with a 302 using just header:location domain as provided with the original code - the Header("HTTP/1.1 301 Moved Permanently"); fixed that!
Thanks so much again - I've been worrying about that problem for weeks!