URL에 URL이 없으면 아래의 .htaccess 파일을 사용하여 "언어 접두어"로 리디렉션합니다. 따라서 domain.com/news를 입력하면 domain.com/en/news로 리디렉션됩니다. 제대로 작동합니다..htaccess 문제
이 규칙은 images, swf 및 myphp와 같은 특정 폴더에는 적용하지 말아야합니다. 처음 두 개는 정상적으로 작동하므로 domain.com/swf에 액세스하면 디렉토리 내용 목록이 표시되고 "en"이 추가되지 않습니다.
그러나 "myphp"폴더 (phpmyadmin 설치)에서는 작동하지 않습니다. 보통은 myphp/index.php를로드하지만 파일 이름을 룰에 추가하면 아무런 효과가 없습니다. 페이지는로드를 계속하지만 아무 일도 일어나지 않습니다. 아무도 이유를 아나요?
RewriteEngine On
RewriteBase/
#force redirect to language specific page
RewriteCond $1 !^(en|fr|nl)$
#dont apply the rule to the assets folders
RewriteCond $1 !^images$
RewriteCond $1 !^swf$
RewriteCond $1 !^myphp$
#redirect to default EN page if no language param is present in URI
RewriteRule ^([^/]+)/.* /en/$0 [L,R=301]
#remove index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteRule ^(.*)$ /index.php?$1 [L]