Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Hit tracking and 404 handling plugin.
Well, hit_logger does much more than that, but I’m trying to figure out the best way to handle the 404 code and thought I’d get feedback from you folks. At first I tried redirecting the browser to the root of the current website. I have tags for “is_404” and such, but it was a bit of a pain to deal with. Right now I have a config parameter for the full path, which works better.
So I set my system up to go to a section of “404” http://127.0.0.1/404
, which is pretty straightforward. My 404 section basically has some tags to handle things, including an automated search:
<pre>
<txp:hit_logger_if_search>
<txp:hit_logger_search_engine />: <txp:hit_logger_search_phrase />
<txp:else /> <p>Sorry that the page that you were looking for couldn’t be found. Feel free to poke around and see if you can find what you were looking for.</p>
<p>You might also tell <txp:hit_logger_referring_host /> to fix their link.</p></txp:hit_logger_if_search>
</pre>
After this bit of text, the standard Textpattern search mechanism is used to output a list of articles that match the phrase that the user typed into the search engine.
Does this make sense? I have things like <txp:hit_logger_if_is_404>
of course.
The disadvantage of the way I’m handling things is that the incoming URL is changed to http://127.0.0.1/404?i=123&q=search_phrase
– I’m a little afraid that search engines will start to think that’s the proper home for the file. Should I call header("HTTP/1.1 301 Moved Permanently");
?
At some point I’d like to make the redirection use the URI to tell where the destination should be. This way I can redirect things that are no longer in “/writing/scripts/” towards the new home at “/portfolio/scripts”. I get hundreds of 404’s a day, even though files have been missing/moved for 10 months. It’s puzzling and I figure I might as well take care of the problem…
Any input is welcome!
[Lee]
Monkeys could have written a better post..
Offline
Pages: 1