Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.