2015-01-06 4 views
0

.HTACCESS 파일을 편집하는 동안 404 및 500과 같은 오류가 발생하는 사용자를 리디렉션하는 적절한 행을 추가했습니다. 특정 메시지를 표시하도록 말하면 매력과 같이 작동합니다. 그러나 사용자 지정 오류 페이지로 사용자를 리디렉션하도록 파일에 지시하면 실패합니다. 제 404 리디렉션을 테스트 할 때 내가 얻을이 :PHP 404 오류가 리디렉션되지 않음

Not Found 
The requested URL /143/test.php was not found on this server. 
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. 
Apache/2.4.9 (Win64) PHP/5.5.12 Server at localhost Port 80 

당신이 내 ErrorDocument를 찾을 수없는 것을 주장한다하지만 내가 작성한 ErrorDocument URL을 입력하면 나 자신이 갈 수에서 볼 수 있듯이. 내 htaccess로 파일은 다음과 같다 :

ErrorDocument 400 /error.php 
ErrorDocument 401 /error.php 
ErrorDocument 403 /error.php 
ErrorDocument 404 /error.php 
ErrorDocument 500 /error.php 
ErrorDocument 502 /error.php 
ErrorDocument 504 /error.php 

php_flag display_startup_errors off 
php_flag display_errors off 
php_flag html_errors off 
# enable PHP error logging 
php_flag log_errors on 
php_value error_log PHP_errors.log 

참고 : 내가 사용하고 로컬 호스트 (WAMP). 감사합니다. .

답변

0

"/143/test.php"이라는 파일을 찾고 있었지만 (보통) yout .htaccess이 웹 루트에 포함됩니다. .htaccess/143 디렉토리의 error.php을 찾고 있으므로 사본을 복사하거나 .htaccess

+0

에 절대 URL을 사용하십시오. /error.php를 /143/error.php로 변경 한 후 제대로 작동했습니다. 나는 .htaccess가 그런 루트 폴더를 보았다는 것을 이해하지 못했다. 고맙습니다 :) –

관련 문제