내 학교에 소규모 학부모/교사 소셜 네트워크가 있습니다. 나는 .htaccess
파일을 사용하여 교사 프로파일에 대한 링크를보다 명확하게 만들고 모든 URL에 후행 슬래시를 추가합니다. /teachers/teacher-name/
(때때로) 링크가 /teachers/teacher-name.php.php.php.php.php.php.php.php...
으로 리디렉션 될 때이 문제가 발생합니다. 아래는 내 .htaccess
파일입니다. 경우에 따라 Chrome에서 브라우저 캐시를 지우면 임시로 수정됩니다. 정확히 .htaccess
구문을 사용할 수는 없지만 꽤 잘 알고 있습니다. 모든 제안을 부탁드립니다!.htaccess 여러 개의 .php 확장자를 추가하는 리디렉션 루프
RewriteEngine on
RewriteBase/
#remove php ext
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ $1/$2.php
#force trailing slash/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)([^/])$ /$1$2/ [L,R=301]
#other rewrites
RewriteRule ^teachers/([^/\.]+)/$ /teachers/profile.php?u=$1
RewriteRule ^teachers/([^/\.]+)/posts/$ /teachers/posts.php?u=$1
RewriteRule ^teachers/([^/\.]+)/posts/([^/\.]+)/$ /teachers/post.php?u=$1&p=$2
RewriteRule ^gallery/([^/\.]+)/$ /gallery/album.php?n=$1
RewriteRule ^gallery/([^/\.]+)/slideshow/$ /gallery/slideshow.php?n=$1
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/$ /gallery/photo.php?a=$1&p=$2&e=$3
편집 : 나는 정확히 내가 무슨 말의 스크린 샷을 첨부했다.
이'당신은'.htaccess' 파일을 추가하는 것을 잊었다 – Umbrella
을 .htaccess' – jprofitt
아차 .. 죄송합니다 .. 고정. –