The Permalink Finder Plugin detects when WordPress cannot find a permalink. Before it generates the 404 error it tries to locate any posts with similar words. It does this by searching through the database trying to find any of the word values from the bad link. It takes the best match and then, rather than issuing a 404 error it sends back a redirect to the correct page.
Users will see the page that they are looking for, and search engine spiders will see the 301 redirect and update their databases so that the page appears correctly in searches.
This is especially useful where WordPress removes words like “the” and “a” from the permalink during conversions from Blogger accounts. It is also useful for migrations that formerly used extensions such as html and shtml, when WordPress does not.
The search of the database requires a small amount of extra overhead, but it only occurs when WordPress cannot find the original post and resorts to using this plugin, which should be rare, especially after the search engines fix up their own indexes.
The configuration panel allows a user to select how the plugin finds a missing page. The plugin counts the number of words that match to a post. By default, a two word match is sufficient to cause a redirect to the found page. False positives are possible, especially if the user selects a one word match. Increasing the number of words, however makes it unlikely that the plugin will ever find a match.
Optionally, the plugin will redirect hits on index.html, index.htm, and index.shtml to the blog home page. This is useful when a website previously used a non-php home page.
The plugin will also optionally keep track of the last few 404′s or redirects. This is useful to find out what pages are missing or named badly that keep causing 404 errors or forcing redirects.
On WordPress MU networked installations the plugin can be installed as a network plugin. On Blog #1, the settings can be made so that all other networked blogs will not see the settings. The statistics then will only be visible on the main blog (#1).
Note: The permalink structure on your blog must be set to include postname. This plugin is only for use with postname permalink structures.
Donations:
If you find this plugin useful and you wish to support me, you can buy my book (cheap) Error Message Eyes: A Programmer’s Guide to the Digital Soul
At the very least please visit my websites and, if appropriate, add a link to one on your blog:
Blog's Eye (My WordPress Plugins and other PHP coding projects)
Wandering Blog (My personal Blog)
Resources for Science Fiction (Writing Science Fiction)
The JT30 Page (Amplified Blues Harmonica)
Harp Amps (Vacuum Tube Amplifiers for Blues)
Bee Progress Beekeeping Blog (My adventures as a new beekeeper)
Download
Latest version: Download Permalink Finder v1.70 [zip]
Installation
- Download the plugin.
- Upload the plugin to your wp-content/plugins directory.
- Activate the plugin.
- Change any options in the Permalink Finder settings.
The plugin can be tested by adding or deleting words from a working permalink in your browser address area. Even if you mangle the permalink it should find a valid link and almost always it will find the correct link.
FAQ
Changelog
1.0
- initial release
1.1
- added ability select degree of matching on bad urls.
- added the ability to redirect index.htm, index.html and index.shtml to blog home page.
- fixed a stupid name in the install directory – should be “permalink-finder” no s.
1.11
- 10/26/2009 Fixed index option to work on PHP4 on some servers.
1.20
- 11/04/2009 Added a short log of fixed and unfixed permalinks.
1.21
- 11/24/2009 Fixed a bug in recording the permalinks that caused a 500 error. Formatted the urls as links in the report.
1.30
- 01/10/2010 added uninstall procedure. Add links to 404 area of report.
1.40
- 02/23/2010 Fixed errors setting and unsetting variables.
1.50
- 04/29/2010 Changed redirect method for to make the plugin compatible with future versions of WordPress.
1.60
- 01/14/2011 Cleaned up code. Added support for MU. Used wordpress functions to sanitize urls and find alternate encodings.
- This revision changed the way the plugin works, so please let me know if you experience any problems.
1.70
- Due to many suggestions for features: Added code to strip get parameters like UTM tags. Added code to optionally strip numbers, common words, and short words.
Permalink-Finder is a most awesome plugin. Thank you so much for creating it and I will donate when I can (short of cash at the second – you know how it is…).
A request: if it finds multiple possible posts could it return a list of them?
A typo: In the 2nd paragraph on the right of the settings it says “If your have incoming links to index.html” and the you_r_ should be you.
Many thanks and have fun with your bees. I kept bees for about 30 years and want to start again. Some year.
Cheers
-Walter
Sugar Mountain Farm
Pastured Pigs, Sheep & Kids
in the mountains of Vermont
Read about our on-farm butcher shop project:
http://SugarMtnFarm.com/butchershop
http://SugarMtnFarm.com/csa
Most excellent plugin! One problem for me though. It won’t work with utm codes.
I’m guessing because the utm tag screws things up. It’s a real pain in the butt for me cuz I am feeding a lot of links to Twitter etc while at the same time using a duplicate post remover plugin on my wp.
Any tweaks, solutions, hacks etc that might work?
Most excellent plugin! One problem for me though. It won’t work with utm codes like this:
http:// youtubetwitter.interactiveportals.x10hosting. com/01/07/only-for-lilly-fail-song-2/?utm_source=twitterfeed&utm_medium=twitter
won’t redirect to
http:// youtubetwitter.interactiveportals.x10hosting. com/01/07/only-for-lilly-fail-song/
The first one is a duplicate post sent to Twitter through Tweetfeed automatically then removed as a duplicate. The second url is the original.
I’m guessing because the utm tag screws things up. It’s a real pain in the butt for me cuz I am feeding a lot of links to Twitter etc while at the same time using a duplicate post remover plugin on my wp at the same time.
Any tweaks, solutions, hacks etc that might work?
Well, I’ve kind of half fixed the problem by installing the “404-to-start” plugin from wp. Your plugin still works for normal missing url files. And, my blog now redirects to the homepage for missing pages link tagged by twitter with ?utm_source=twitterfeed&utm_medium=twitter instead of the 404 page.
It’s better. But, still not what I want.
I want link finder to ignore the utm tags.
Any info? Would make a great addition to the plugin.
Great plugins! These plugins can be overcome if the crawl errors found in google webmaster tools? If yes how long will it take? Thanks for helping
Google says that a 301 encountered by their spiders will change the index. The original link to the bad page needs to be changed or Google will not forget the page in question.
Make sure that the xml sitemap is correct and that should go a long way to fixing Google.
I still get lots of hits on bad pages because of sites linking to old pages. There is no way to stop that, and Google will follow the same links.
hi,
The plugin is almost perfect…
When I ve a 404 error the permalink finder plugin will find a alternative post but in lot of cases I ve posts ends with a number like:
description-11
the plugin will first search on the number (if searchin on one word). But I wish that this plugin in first case will do request on the first word: “description” instead of 11. Now the result in some cases doesnt make any sense. And I got
nomatch-11
Is there a simple solution to ignore numbers or last word(s)? I hope this is posible or with an update. Thanks!
I should do that. Numbers are a different animal than words as far as searches go. Searching on 11 might result in all posts with 2011 in the title. I will take a look.
I have had a few other suggestions and I will make another release, but I need to let everyone update this one. I don’t like annoying people with frequent releases and I like to keep them at least a few weeks apart, unless it fixes a bug.
Keith
I’m also have the utm problem that Turbo Tweeter mentions.
Hit enter too soon… Thanks for the plugin
Hi,
could you add an option to chose if the redirect should be a 301 or a 302?
Would be really nice
Good idea. I will add it in the next release.
Keith
Great plug-in ! Just what I needed, because I needed to change permalink format and was manually entering redirects into another plugin. I can finally just watch a redirect take place 90% of the time and the 404 error are very low. I like that you have log for last 30, 404 or links…fantastic plugin, worked right out of the box with my site’s other plugins..thanks so much !!
This is a fantastic plug-in. This has taken care of almost all of my 404 errors after moving my blog. Is there any chance of adding the ability for users to specify terms that shouldn’t be used? I have a two word lead in that is in the front of many of my old slugs. Deleting those in the url allows the plug in to do its thing, so if I could exclude them it would get my 404s down to zero. Thanks again for a great plug-in!
It sounds like a useful improvement. I’ve been adding things so I will add this and try to get a new release out soon.
Keith
I too would love an ‘exclude words’ feature
Hey Keith,
This may be an obvious question but…
Will your permalinks plugin work to redirect posts that were originally published with the ‘ugly’ permalink structure?
Great plugin Keith – works great. I am curious as to how it works …
I have an old site where the blog is no longer active. Moved that blog and all of its contents to a new site (domain). We put in a 301 redirect to the new blog to keep the old blog links and SEO intact. The problem you solved for me was that we changed the permalink format from postname to month&postname and the redirect only has the postname in it.
Does this plugin check for a 100% match of postname before it drops back to 2-4 word checking? With the old postname style permalink, for us, that would be a 100% success on match to the new blog with the somewhat mechanical addition of the date to the URL.
Thanks – Dean
It does a match on the “postname” field first to see if it can find the slug. Then is does the keyword search on the posts. I think this is what you would expect. It sanitizes the slug first so you might not get a match on postname if the slug is altered, but as long as just the structure is changed and not the postname it should get a hit.
Keith
Perfect – thanks Brian.
Hello Keith,
I just wanna say thanks for this great plugin! It’s very useful.
Warm regards,
Andi
Hi Keith,
I installed your plugin and set it to the post name permalinks, 2 words, exclude small words, but it is still not working for a site I just launched. speakwellbeing.com has many static pages that need redirected to similar named pages, such as: http://www.speakwellbeing.com/find-a-speaker.php needs to go to http://www.speakwellbeing.com/find-a-speaker . Can you give me some guidance? Thanks in advance.
Clare
Oops, forgot to check notify me of followup comments.
I just tested the plugin on several different sites. I added the .php to the end of the slug and it redirected correctly. I don’t know what is happening on your website.
Keith
Hi,
I installed the plugin on 2 sites recently and each time I enable the ‘Track 404 and redirects’ option it resets to ‘disabled’ the next time I look at settings.. Any thoughts on why this happens. The Redirection plugin is also installed and I notice it’s acting strange (error log shows 404 and redirects, the dates are not in descending order.. ).