ErrorDocument and permalinks

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 26, 2015   (RSS)

By Twocans - June 23, 2015

Hi yea,

# error docs below start
ErrorDocument 400 errors/badrequest.html
ErrorDocument 401 errors/authreq.html
ErrorDocument 403 errors/accessforbidden.html
ErrorDocument 404 errors/notfound.html
ErrorDocument 500 errors/iserror.html
# error docs below finish

I have the above errror documents but they do not seem to work. I have set them as both shtml and the html but no joy

Were I to no longer to have a page and a punter goes to it, I would have expected my created page to show aka errors/notfound.html

but , 

at present when a page is not found I get the following error with content below on a white page. How can I have it so as my error pages are shown.

regards

k

--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~--~~~~//

Not Found

The requested URL /sdfsdf.php was not found on this server.

Permalinks Dispatcher at www.londonfabriccompany.com Port 80

By gregThomas - June 25, 2015

Hey Twocans, 

This is happening because the permalinks plugin htaccess code hijacks a 404 bad request, and attempts to load a page linked to a permalink instead (if there is one). Then if no permalink is found it loads the 404 page set in the permalinks plugin.

You can set the 404 page used on line 13 of permalinks plugin file:

$GLOBALS['PERMALINKS']['404_not_found_filepath']  = dirname(__FILE__) . '/permalinks_notFound404.php'; // filepath to include if Permalink isn't found

The 400/401/404/500 error pages you've set in htaccess should work correctly.

Thanks,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Twocans - June 26, 2015

Thank You Greg,
I was afraid to manipulate any of the code of the extension in itself but hehe, following your advice all is fine.

$GLOBALS['PERMALINKS']['404_not_found_filepath']  = '../../../errtells/notfound.shtml'; // filepath to include if Permalink isn't found

The above didn't work

Thus all I did was get rid of the dirname(__FILE__) .  and created a dir with error files in my site aka www.mysitename.com/errtells/notfound.shtml

thanks very much for your help

have a great weekend

kenny