How to redirect all not found page to an error page

Viewed 25
Options -MultiViews
RewriteEngine on
ErrorDocument 404 /error.php
RewriteRule ^index.html$ / [R=301,L]
RewriteRule ^(.*)/index.html$ /$1/ [R=301,L]
RewriteCond %{THE_REQUEST} ^.*/index\.php 
RewriteRule ^(.*)index.php$ /$1 [R=301,L] 
RewriteCond %{HTTP_HOST} ^example.com [NC]RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301,NC] 
RewriteRule ^news/([0-9a-zA-Z_-]+)$ /news.php?url=$1 [NC,L]
RewriteRule ^category/([0-9a-zA-Z_-]+)$ /category.php?kategori=$1 [NC,L]

on my .htaccess document

It is working and redirecting to the error page the page when i type www.example.com/hdjskahdjska

But when i typed www.example.com/news.phpdsadsadsa it doesn't redirect to the error page, but it shown me a multiple choice page whether to choose news.php or news.html

And when i typed www.example.com/news/dsadsadsa it shown my page news without any content on it, how can i also redirect that url to an error page ?

I also want when someone typed www.example.com/index.php or www.example.com/index.html to redirect to the error page.

I need your help please Thank you

0 Answers
Related