L
L
Les Alterman2016-08-22 18:50:24
PHP
Les Alterman, 2016-08-22 18:50:24

There is no 404 .htaccess redirect when using CNC. Why?

Good day! When writing the site, there was a need to redirect to the 404 page, but the script written in .htaccess does not work. Routing on the site occurs according to the scheme: mysite.com/controller/action/id.
How to fix?
The content of the .htaccess file

Options +FollowSymLinks
<IfModule mod_rewrite.c>
    SetEnv HTTP_MOD_REWRITE On
    RewriteEngine on
    ErrorDocument 404 /error404.php
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?_route=$1?%{QUERY_STRING} 
</IfModule>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vasiliev, 2018-03-08
@Isolution666

You need to remove RewriteBase /
You are redirecting to the main page, so that you do not enter, if there is no such page, it will go to the main one. By default index.php
But this can be fixed))
Here is a whole blog on this topic

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question