1

I know this topic has been covered a lot; however, I do have a custom .htaccess rule and when I tried to add the below for my 404 custom page, it didn't work and start showing Not found page:

ErrorDocument 404/foldername/error/404.php

My .htaccess rules are as below:

RewriteEngine On

RewriteBase /

# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\.culture-insider\.com$
RewriteRule (.*) https://www.culture-insider.com/$1 [R=301,L]

# Internal rewrite for pages
RewriteRule ^([-a-zA-Z0-9]+)$ index.php?page=$1 [L]

Is there a specific rule that I need to add to show my 404.php custom page or are any changes needed?

Siham
  • 11
  • 1
  • Does this answer your question? [ErrorDocument 404 /404.php is not working in .htaccess file in PHP](https://stackoverflow.com/questions/22976772/errordocument-404-404-php-is-not-working-in-htaccess-file-in-php) NOTES: 1) You seem to be missing a space after "404", 2) path may not be the absolute path to your htdocs folder root but instead the root of your filesystem. Please review the thread I cited. – paulsm4 Jul 24 '21 at 18:15
  • I have tried the same way and checked the logs to see the actual path; however, this led that the whole site has been collapsed and a message of 500 starts showing, it took me more than 20 minutes to fix. Let me explain further my 404.php error is working when misspelling a name; however, when looking for other terms the standard 404 error appear. I am not sure how to customize it not to affect the website and still working and validated for all wrong names – Siham Jul 25 '21 at 13:06
  • Please update your post: 1) Fix `ErrorDocument 404/foldername/error/404.php` (there should be a space after "404", right? 2) Copy/paste the "ErrorDocument" and ".htaccess" text that caused the HTTP 500. 3) Copy/paste the HTTP 500 error from your logs. 4) Give an example "misspelling". 5) Give some examples of "other terms". 6) What is your OS (Ubuntu 18?)? Your Web server (e.g. `apache2 -v`)? – paulsm4 Jul 25 '21 at 15:50

0 Answers0