2016-09-05 4 views
1

좋아요, 그래서 htaccess에 관한 몇 가지 질문이 있습니다.htaccess index.php 루트로 리디렉션

처음에는 누군가 index.php을 입력하더라도 website/index.phpwebsite/이됩니다.

둘째 난 당신에 입력해도 .php를 제거하고 website/about-us/에 마지막 website/about-us.php/을 추가하고 싶습니다.

나는 끝에 확장 제거하려면이 추가 : 확인 /를 추가하는 방법에 100 %를 제외하고

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^\.]+)$ $1.php [NC,L] 

, 그리고 내가 찾은 모든는 URL ISN의 루트에 index.php을 변경하려면 나를 위해 일하고 있지 않아.

답변

0

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^([^/]+)/$ $1.php 
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$ 
RewriteRule (.*)$ /$1/ [R=301,L] 
0

이 규칙을 시도하십시오

DirectoryIndex index.php 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} -f 
RewriteRule ^index.php$ www.{HTTP_HOST}/ [R=301] 
RewriteCond %{REQUEST_FILENAME}.php -f 
RewriteRule ^([^\.]+)$ $1.php [NC,L] 
관련 문제