.htaccess 파일을 사용하여 .php없이 URL을 다시 쓰는 데 문제가 있습니다. 일부 주소에서는 작동하지만 다른 주소에서는 작동하지 않습니다. 여기 .. 내 htaccess로 파일에있는 것입니다 .htaccess를 사용하여 URL에서 .php를 제거 할 때 일부 URL이 작동하지 않습니다.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php
#rewrite url up to 3 levels
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/$ /$1/$2/$3.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]
나는 내 사이트의 다음 폴더/파일 구조를 ..을
index.php
about-us
index.php
careers.php
our-work
index.php
test.php
client1
example.php
다음 URL이 작동 ..
example.com
example.com/about-us
example.com/our-work
example.com/our-work/client1/example
그러나이 작동하지 않습니다 ..
example.com/our-work/test
example.com/about-us/careers
방금 404 오류가 발생합니다.
왜 이런 일이 발생하는지 알고 싶습니다.
좋아요! 완벽하게 작동합니다 .. 감사합니다! – Dustin