회사 직원이 카테고리를 통해 나열되도록 허용하는 콘텐츠 관리 시스템을 구축 중입니다. 본질적으로 이것은 내가 성취하려는 것입니다 :.htaccess 페이지가 맞춤법 오류로 다시 쓰기
404, 500 등의 오류가있는 inside.php
페이지가 있습니다. 변수를 전달하고 변수를 기반으로 특정 정보를 표시하는 physicians.php
이라는 페이지가 있으므로 physicians.php?id=1
은 특정 카테고리의 직원을 표시합니다. 현재 http://website.com/physicians
또는 http://website.com/physicians/
으로 이동하면 http://website.com/physicians.php
으로 리디렉션되지만 의사가 단어를 변형 한 경우에도 문제가 발생합니다. 예를 들어 physiciansasfhouiae
은 아직 기술적으로 존재하지 않는 페이지이기 때문에 physicians.php
에 연결하여 inside.php
에 연결할 수 있습니다. 때문에 년대 RewriteRule
에이 2 줄 필요하지 않습니다
RewriteCond %{REQUEST_URI} physicians
RewriteRule .* physicians.php
뿐만 아니라 :
RewriteEngine on
#enables you to access PHP files with HTML extension
AddType application/x-httpd-php5 .html .htm
RewriteCond ${REQUEST_URI} ^.+$
RewriteRule ^detail/(css|js|img)/(.*)?$ /$1/$2 [L,QSA,R=301] [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule^- [L]
RewriteCond %{REQUEST_URI} physicians
RewriteRule .* physicians.php
RewriteRule ^physicians/((([a-zA-Z0-9_-]+)/?)*)$ physicians.php?id=$1 [NC,L]
RewriteRule ^((([a-zA-Z0-9_-]+)/?)*)$ inside.php?page=$1
잘 모르겠습니다. 왜 제대로 작동하는지 이해하지만 작동합니다. 고맙습니다. – Cody