Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Redirect 404 - Page Not Found
Hello,
I was wondering how I can redirect 404 Page Not Found errors to a specific page for instance if I have clean URLs on, I want to redirect it to: http://www.domain.com/error/ how can I accomplish this? Do I need to edit my .htaccess file? If so, what would I have to type in?
Ian Gordon
Ian Gordon Online
http://www.iangordon.us
Offline
Re: Redirect 404 - Page Not Found
TXP 4.0.1 has a simple 404 page built-in but if you can wait for 4.0.2 you will find that you can have your own 404 template which TXP will use instead. I can’t advise you on re-directing to your already-existing page unless you want to install the LXS Hit Tracker plugin though this does a hell of a lot more than redirecting to your 404 page.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#3 2005-10-04 21:26:05
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Redirect 404 - Page Not Found
In v4.0.1 this works for me:
- Make “error” section
- Create an article for your error page under that section
- Title: “Article Not Found” (or whatever)
- Body: “The page you are looking for can’t be found. Why not try the site search?”
- Download/install/enable sgb_url_handler & sgb_error_documents (I’m using v0.1.5 & 0.1.1, respectively)
- In sgb_error_documents, edit config to your article id:
$sgb_config['error_documents']['404']['id'] = 7;
I’m not sure if this works for everyone, but it’s the method I’ve used on another site since an earlier release candidate and still continues to work through v4.0.1. I also don’t know the current status of the plugins, whether they’re 4.0.1-compatible, or if this is still the config method.
Or you could just wait for 4.0.2 ;-) That’s just my 2¢.
Offline
Re: Redirect 404 - Page Not Found
There isn’t a way to do it with mod_rewrite?
Ian Gordon
Ian Gordon Online
http://www.iangordon.us
Offline
#5 2005-10-05 03:55:44
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Redirect 404 - Page Not Found
Nope.
Reason: there is no going back once mod_rewrite has gone through its initial check of “Does this file or directory exist? No? Ok… then I’m serving up the request to index.php!” That makes it up to Textpattern to do the logic involved in figuring out if the requested URL fits within any existing possible URL schema.
Even though this may seem strange, it’s actually quite common. Both Movable Type (mtview.php) and Wordpress also use this internal errordocument system.
Offline
Re: Redirect 404 - Page Not Found
well how can I change the error doc system to show the page I want it to?
Ian Gordon
Ian Gordon Online
http://www.iangordon.us
Offline
Re: Redirect 404 - Page Not Found
Well if you would like to install r996 then you can download it here and there is a short piece about it in the Dev Weblog.
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#8 2005-10-05 19:54:45
- Andrew
- Plugin Author
- Registered: 2004-02-23
- Posts: 730
Re: Redirect 404 - Page Not Found
Ian, you’ve got two three options:
- The plugin + article method I outlined
- Download the latest build of Textpattern and use the newly-developed (but not yet released) error templates
- Via SVN
- Via WebDAV (path has changed from
/current
to/development/4.0
)
- Wait for v4.0.2 (shouldn’t be that far down the road)
Offline
Re: Redirect 404 - Page Not Found
Actually I found a simple solutions. The files “textpattern/lib/textlib_misc.php” at the end of the file, it has the HTML code for the error page, simply replace that with whatever HTML you want for your custom error page!
Ian Gordon
Ian Gordon Online
http://www.iangordon.us
Offline
Re: Redirect 404 - Page Not Found
This will work for the time being, but I think when you upgrade you will have problems. As Andrew mentioned, the newer version of Textpattern has better 404 support.
Offline
Re: Redirect 404 - Page Not Found
That’s the most obvious solution, if it’s good enough for you that’s fine. Hacking the base-code often generates problems down the road when upgrading, and you will have to upgrade.
<i>(Any yes, 4.0.2 shouldn’t be that far down the road.)</i>
Offline
Re: Redirect 404 - Page Not Found
Well, I mean I have the original file and it was just HTML between two end doc variables, so I am not worried, that was all i edited.
Ian Gordon
Ian Gordon Online
http://www.iangordon.us
Offline
Pages: 1