Htaccess 404 page for specific subdirectory only (static html pages)

How can I add a 404 page to a specific subdirectory?

In my case the 404 page should only affect the staging subdirectory (and the directories inside of staging) but not the root or any other subdirectories placed in root.

http://example.com/staging

The code which is in my .htaccess file for the directory “staging”:

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*)$ $1.html [L]

Options -Indexes -MultiViews
RewriteEngine on

RewriteRule ^arbeiten/$ /staging/arbeiten/alle [R=301,L]
RewriteRule ^journal/$ /staging/journal/journal-alle [R=301,L]

ErrorDocument 404 /staging/404.html

Using the code above (and many others) results in a Internal Server Error.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.