Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-31 01:34:13

Finner
Member
Registered: 2005-05-04
Posts: 33

Setting error pages through .htaccess

I’m wondering how I can use the .htaccess file to set the path to my 404 error page with textpattern. I’ve done it for my other sites on my server, it’s just something seems to be conflicting with textpattern – seems to have an error page of its own. I’ve deleted the error_default page, but now I just get a page saying ‘The requested page was not found.’, and not the one I’m setting through the .htaccess file.

Offline

#2 2006-10-31 02:56:07

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Setting error pages through .htaccess

Textpattern requires it’s own error page.

Last edited by Mary (2006-10-31 02:56:31)

Offline

#3 2006-10-31 07:36:55

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Setting error pages through .htaccess

Due to the way that clean-urls work, you cannot use error-pages defined by the webserver. That’s a limitation of webservers.

You can however, change your error_default page to simply include a static file from the webserver (your error-page), with a little php-snippet or a 1-line long plugin, if you do not want to enable php in templates.

Offline

#4 2006-10-31 07:46:15

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,012
Website GitHub Mastodon Twitter

Re: Setting error pages through .htaccess

Sencer wrote:

You can however, change your error_default page to simply include a static file from the webserver (your error-page), with a little php-snippet or a 1-line long plugin, if you do not want to enable php in templates.

Mmmmm!!! A plugin like that would be very cool..


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2006-11-01 02:24:44

NyteOwl
Member
From: Nova Scotia, Canada
Registered: 2005-09-24
Posts: 539

Re: Setting error pages through .htaccess

You don’t need a plug-in.

You can create seperate error pages, just like any other page (at least in 4.0.3) They should be named error_### with the appropriate error number (eg error_404). If they exist, Textpattern will use them otherwise it will use error_default.


Obsolescence is just a lack of imagination. / 36-bits Forever! / #include <disclaimer.h>;

Offline

#6 2006-11-01 08:43:48

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Setting error pages through .htaccess

Well, you’d need a plugin if you want to share the same error page, that’s all. I’ve got one I use on my own site, I should package it up.

Last edited by Mary (2006-11-01 08:44:00)

Offline

#7 2006-11-13 05:16:13

Finner
Member
Registered: 2005-05-04
Posts: 33

Re: Setting error pages through .htaccess

Thanks for all the replies (sorry about the delay, uni essay put fixing my site on hold for a bit!).
Yes, a plug-in would make it really handy if you modify your error pages a lot. . . I suppose you could just put url redirects in for each error_### page in textpattern to an error page located globally on your server… ?

p.s. love your site mary!

Last edited by Finner (2006-11-13 05:18:26)

Offline

#8 2006-11-13 23:22:03

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Setting error pages through .htaccess

I suppose you could just put url redirects in for each error_### page in textpattern to an error page located globally on your server…

Yep. I’ve started doing that now.

Offline

#9 2006-11-14 09:48:19

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: Setting error pages through .htaccess

just put url redirects in for each error_### page

Redirects break http-return codes.
You also run the risk of setting an infinite redirection, if at any point in time you accidently delete/move the static error pages, when using redirects.

Also: Isn’t readfile() in your txp-error-template just as easy if not easier than setting up a redirect?

Offline

#10 2006-11-14 13:38:42

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Setting error pages through .htaccess

I assumed he meant error pages, e.g: ErrorDocument 401 /error_401

Offline

Board footer

Powered by FluxBB