ChaosKnight Posted June 28, 2010 Share Posted June 28, 2010 Hi, I don't really know where this post should go, I have made a custom 404 error page called error.php, I want to make it a little smarter to get the URL that Google tried to access and try to find the best solution to where it should redirect the user with a 301. I have converted a website from .htm pages to .php and the website is losing a lot of web traffic. So what I need to know is if there's a way to get the URL that Google or other search engines requested? and what is the easiest way to dissect it in sections (like: /south_africa/default.htm into 2 variables, the one will contain south_africa and the other default.htm). Is this possible? Thanks Link to comment https://forums.phpfreaks.com/topic/206082-url-that-google-tried-to-access/ Share on other sites More sharing options...
Adam Posted June 28, 2010 Share Posted June 28, 2010 Where are you expecting to get the URL from? Link to comment https://forums.phpfreaks.com/topic/206082-url-that-google-tried-to-access/#findComment-1078300 Share on other sites More sharing options...
ChaosKnight Posted June 28, 2010 Author Share Posted June 28, 2010 I was hoping that there is some $_SERVER element that carries these URLs Link to comment https://forums.phpfreaks.com/topic/206082-url-that-google-tried-to-access/#findComment-1078335 Share on other sites More sharing options...
premiso Posted June 28, 2010 Share Posted June 28, 2010 Why not just setup an htaccess file that redirects a 301 redirect any page that ends with .htm (via request) to .php. If it was a transparent .htm -> .php that should be fine. The other option would be to revert it back to .htm and add that as a type that is parsed by php. Link to comment https://forums.phpfreaks.com/topic/206082-url-that-google-tried-to-access/#findComment-1078340 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.