I have a 404 error page and tried the below code which was generated from this link. But when the wrong URL is entered it redirects to the main page, not to the 404 error page
<IfModule mod_rewrite.c>
RewriteEngine On
ErrorDocument 404 https://www.rcis.in/404.php
</IfModule>
I have added the code in htaccess file. And also how to remove the file extension from the URL. Down below is the code I tried
#Remove extension
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
And I tried below code which was generated from that website which is mentioned above
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/?(.*).(php)$ /$1 [R=301,L]
</IfModule>
How can I solve these two
Thank You in advance