Apache HTTP Server

404 redirection by .htaccess

Kartic1 min read

File name should be .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect when file, directory not available in directory which contain .htaccess
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . 404.php [L]

# Redirect by ErrorDocument directive globally [ ErrorDocument <3-digit-code> <action> ]
ErrorDocument 404 /404.php

</IfModule>
Share this articleLinkedIn X

Discussion (0)

Sign in to join the discussion.

Delete this comment?

This will also remove its replies.

Keep exploring

Apache HTTP Server1 min read

Mail service integration in ubuntu VPS server

To set up email services on an Ubuntu VPS server, you can use a mail server software like Postfix for sending emails and Dovecot for receiving and storing emails. Here's a basic gu...

Kartic · Mar 6, 2024

Follow the engineering notes.

Subscribe for technical articles from iTechOrbit.