.htaccess 파일을 작성하여 오류 코드와 함께 색인을 보내고 전송하려고합니다. 예제 index.php? error404 또는 index.php? error501..htaccess를 사용하여 오류 캐치
아래 코드를 사용하여 루트 디렉토리에 오류가 발생할 수 있습니다.
ErrorDocument 404 index.php?error=404
ErrorDocument 501 index.php?error=501
예제 http://www.domain.com/file_does_not_exist.php이 작동합니다. 결과 http://www.domain.com/index.php?error=404
문제는 하위 디렉토리에서 index.php 오류를 포착하여 보내는 것입니다.
예 http://www.domain.com/directory_does_not_exist 또는 http://www.domain.com/directory_and/file_does_not_exist.php.
결과는 http://www.domain.com/directory_does_not_exist/index.php?error=404이며 따라서 index.php의 CSS가 손상되었습니다.
아래 코드를 시도해 보았습니다. URL을 다시 작성하여 index.php로 다시 리디렉션하려고합니다.
RewriteCond $1 !^err[45][0-9][0-9]$
RewriteRule ^\/.\/\.php$ /index.php?s=$1 [R]
AND
RewriteCond $1 !^err[45][0-9][0-9]$
RewriteRule ^([/]?*)\.php$ /index.php?s=$1 [QSA,L]
어떤 도움을 주시면 감사하겠습니다.
빠르고 정확한! – undone