Page 1 of 1

Custom 404 error page doesn't function Rewrite Urls [Solved]

Posted: Thu Dec 19, 2013 1:14 am
by Joesurf
I am using URL rewrite in my sites .htaccess file so we have pretty URL's.

This is also blocking my custom designed 404 error page code in the same .htaccess file.

ErrorDocument 404 /404.php

CMSms version 1.10.3

Commenting out the URL rewrite code proves that the (ErrorDocument 404 /404.php) does function.

<IfModule mod_rewrite.c>
RewriteEngine on
#
#Sub-dir e.g: /cmsms
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.
#RewriteCond %{REQUEST_URI} !/$
#RewriteCond %{REQUEST_URI} !\.
#RewriteCond %{REQUEST_METHOD} !POST$
#RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
#

Your help is greatly appreciated.

Thank you

Re: Custom 404 error page doesn't function with Rewrite Urls

Posted: Thu Dec 19, 2013 3:45 am
by JohnnyB
This doesn't matter but, I'm curious, why the rewrite rules were not included in your post? Is the code below in the .htaccess file?

Code: Select all

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]
Anyway, I use CMS Made Simple's 404 error page management so I can control the content the visitor sees from within the CMSMS Admin Console. Just create a page using Content Type set to Error Page. You can control the content, choose a template, etc...

The reason I do this is because setting default error documents can differ depending upon your server software (Apache, Litespeed, Lighttpd, etc.,) and the version. CMSMS takes the guesswork out of it and allows my clients to manage their 404 content from within the CMS which can help with marketing, usability, and etc...

Custom 404 error page doesn't function with Rewrite Urls -So

Posted: Thu Dec 19, 2013 4:27 am
by Joesurf
Ok - so now that I am sufficiently embarrassed after spending over an hour searching for the obvious CMSms answer to my custom 404 page within CMSms, you are a hero with your answer.

I looked everywhere - except the page content type!

Made the content type change in about 20 seconds and all is functioning as desired.

Yes the rewrite rules are in place:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA,L]

Thanks so much for your help!

Joe ;D