프로젝트를 진행하고 있지만 오류가 발생했습니다.404 오류로 표시되지 않습니다.
index.php?view=$1
을 /
으로 리디렉션하는 RewriteRule이 있습니다. 그러나 404 오류로 이어질 것으로 예상되는 URL에 액세스하면 대신 홈 페이지 (index.php)가 표시됩니다.
ErrorDocument 404 /pages/errors/error_redirect.php
ErrorDocument 500 /pages/errors/error_redirect.php
Options +FollowSymlinks
RewriteEngine On
RewriteBase/
<FilesMatch "\.tpl$">
Order Allow,Deny
Deny from all
</FilesMatch>
RewriteCond %{REQUEST_URI} ^/404/$
RewriteRule ^(.*)$ /pages/errors/404.php [L]
RewriteCond %{REQUEST_URI} ^/500/$
RewriteRule ^(.*)$ /pages/errors/500.php [L]
RewriteCond %{REQUEST_FILENAME} !-l
# Rewrite all URLs to non-extension URLs
RewriteRule ^(admin|user)($|/) - [L]
RewriteRule ^([A-Za-z0-9-_]+)$ /index.php?view=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]
내가 직면하고 문제는 내가 http://localhost/asdasdads
를 입력 한 경우, 브라우저가 아닌 브라우저에서 변경되지 않은 URL하지만 브라우저 표시의 index.php로 http://localhost/
를 알려준 것입니다. 404 오류 페이지가 표시되어야합니다.
RewriteRule ^([A-Za-z0-9-_]+)$ /index.php?view=$1 [L]
이이 문제의 근본 원인이라고 생각합니다. /index.php?view=asdasdads
을 /index.php?view=
으로 리디렉션하고 있기 때문에 찾을 수 없습니다. 대신 404로 리디렉션하고 싶습니다.
미리 감사드립니다.