E
E
Eugene Ordinary2016-09-15 22:59:55
Apache HTTP Server
Eugene Ordinary, 2016-09-15 22:59:55

What is the sequence of actions with ErrorDocument and mod_rewrite?

In htaccess, these commands are:
RewriteRule ^([\da-z_]+)$ index.php?gotoalias=$1 [NC,QSA,L]
ErrorDocument 404 /err_404.php
ErrorDocument 403 /err_403.php
If the URL is example.com/ noexistfolder and the noexistsfolder folder does not exist, then everything is fine, displays the page on request index.php?gotoalias=noexistfolder
If an address like example.com/existfolder is requested and existsfolder exists, but is closed from listing, then redirects to
example.com/existsfolder/? gotoalias=existsfolder ,
but it gives the contents of err_403.php.
I do not understand why it happens, in what order the rules are executed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Zayko, 2016-09-16
@popcorn2d

In general, it is bad practice to write CNC through htaccess, write a router) And all your errors will disappear, because they will be processed by PHP

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question