Jump to content

URL that Google tried to access


ChaosKnight

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.