v.7

Make sure your connection is secure ("httpS:" instead of just "http:"). Click the logo above for a secure connection.

| Menu ☰ |
× close
Home Products Services Blog Contact

CMSbyCW Demo CMSbyCW Tutorials / FAQs / Documentation CW Cyberspace Invaders (people liked it!) What's cooking?

How to customize your CMSbyCW .htaccess file so that all "Page Not Found " on your website goes to your own 404 page

How to customize your CMSbyCW .htaccess file so that all "Page Not Found " on your website goes to your own 404 page

Published on: 02/08/2026, 07:00 PM by Software Developer

The ZIP file includes an .htaccess file (you can edit this in "Notepad").  

What does this file do?  

If a Website Visitor goes to a non-existent page, it will go to your own 404 - Page not found webpage. 

I added this htaccess file to the package, so you just customize one line, to point to your own domain name. 

For example, the current .htaccess code is: 

# Enable Rewrite Engine
RewriteEngine On

# Check if the request is for the current domain
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]

# If a 404 error occurs, use the custom 404.html page
ErrorDocument 404 /404.html

Just change it to your own domain name, so for example, if your domain name is mydomain.net, this is how you change the code: 

# Enable Rewrite Engine
RewriteEngine On

# Check if the request is for the current domain
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.net$ [NC]

# If a 404 error occurs, use the custom 404.html page
ErrorDocument 404 /404.html

I created this because some Webhosts redirect it to their own 404 page, with no clear link to go back to your own Home Page. 

This is all you need to change on this htaccess file. 

You don't have to do anything on the 404.html page, since I already included a link back to your Home Page. 

To test this, click this non-existent page (it will open in a new tab): 

https://www.cmsbycw.com/whatever

And you will see how the codes above work, by redirecting it to the 404.html webpage that I have also included in the Software Package.  It will say : 

"404 - Page Not Found

Sorry, we couldn't find the page you're looking for.

Return to Home"

With the link back to your Home Page.  

So your web visitors don't get lost and stuck in a webpage that is not your own.  

Related:

Help Page for other Documentation or Tutorials:

Help

Got feedback?

Click HERE and Leave a comment

Share:




Thank you for visiting our website!