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

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
Joesurf
Forum Members
Forum Members
Posts: 35
Joined: Wed Apr 01, 2009 11:36 pm
Location: Carlsbad California

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

Post 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
Last edited by Joesurf on Thu Dec 19, 2013 4:29 am, edited 1 time in total.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

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

Post 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...
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Joesurf
Forum Members
Forum Members
Posts: 35
Joined: Wed Apr 01, 2009 11:36 pm
Location: Carlsbad California

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

Post 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
Post Reply

Return to “The Lounge”