2013-11-03 3 views
0

domain.com/page.php를 입력하면 domain.com/page/로 자동 변경되지 않습니다. 또한 하위 디렉토리에있는 페이지의 경우 domain.com/sub/1/ 링크를 따라 가면 괜찮습니다. 그러나 브라우저에 입력하면 domain.com/1/로 리디렉션됩니다..htaccess 파일 확장명 숨김 및 후행 슬래시 강제 적용

이것은 무엇입니까? 내가

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^([^/]+)/$ $1.php 

# Forces a trailing slash to be added 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ 
RewriteRule (.*)$ /$1/ [R=301,L] 

나는 하위 디렉토리와 루트 디렉토리에 htaccess로 파일에 무엇을해야하는지 어떤 아이디어 htaccess로

에 있나요? 나는 이것에 관해 새로운 사람이다.

답변

0

규칙의 순서를 변경하십시오.

이 시도 :

RewriteEngine on 

# Forces a trailing slash to be added 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.+?[^/])$ /$1/ [R=301,L] 

# .php ext hiding 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{DOCUMENT_ROOT}/$1.php -f 
RewriteRule ^(.+?)/?$ /$1.php [L] 
관련 문제