In my file search.php, I have got it programmed so that it reads the value of $_GET['category']. It then matches that value with an array called $cats, if the value exists in $cats it displays some data on the page. If it does not exist, it redirects the user to another page (directory.php), using the php header() function. Now lets say I have a URL as such: /search.php?category=hotels This got indexed by Google but recently I changed the category 'hotels' to 'uk_hotels'. So now if anybody clicks the indexed link in Google, it redirects the user to 'directory.php'. Does anybody know how this change will affect the Google link when it does a refresh of the index, i.e will it display the title of the page it is redirecting to or will it just leave everything as it is?
When Google next spiders your site, it'll update just fine. Could always add an exception to handle the hits coming from Google. Dan.
Thanks. OK I just did a test for that redirected URL on http://www.rexswain.com/httpview.html It says it's a 302 redirect, which is fine, however it seems to be processing the whole search.php file even though I've got the header() redirect code before it even includes the template file. Anybody know what's going on there?
Cheers, I'll try that. It doesn't make sense though, I thought as soon as it encounters the header function it would stop processing the rest of the code and just process whatever the header function tells it to do!
No, sending a header does not stop code execution, most regular browsers (e.g. Firefox) will simply redirect immediately. They will ignore content. It will still display though, which is a good opportunity to display a regular hyperlink for those browsers (and robots) which do not follow Location: (or similar) headers correctly. Dan.