I
I
Igor Nikiforov2016-11-03 13:23:29
htaccess
Igor Nikiforov, 2016-11-03 13:23:29

Why does Deny from xxxx and ErrorDocument 403 give a 302 redirect?

My htaccess file

Options All -Indexes
#Error
ErrorDocument 403 http://sitename/error/403
#запрет доступа к сайту по IP
Order Allow,Deny
Allow from all
Deny from *.*.*.*

#убираю пхп в конце
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

In the 403.php file, I send the header as the first line
header("HTTP/1.1 403 Forbidden");
. As a result, the browser issues The site has redirected too many times.
What is wrong, please explain?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Nikiforov, 2016-11-03
@hand_stand

I understood what the problem was, deny redirected to the 403 page, but access was denied there too, there was no 403 response, I added htaccess to the error folder

#разрешен доступ всем
Order Allow,Deny
Allow from all

Is this decision correct?

S
SagePtr, 2016-11-03
@SagePtr

Because the ErrorDocument directive, when an absolute URL is specified as a parameter, performs a redirect on the corresponding error.
Apparently, the page with the error itself is also prohibited for you, therefore, when this page is requested, a redirect to it is performed again, and so on ad infinitum.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question