0
좋아 길고도 짧은 이야기 :htaccess로 하위 도메인의 트래픽을 폴더로 하위 폴더
http://subdomain.domain.com/test1/test2 요구는 여기에 정보를 표시합니다 : 분명히 http://domain.com/agents/subdomain/test1/test2
과이 http://subdomain.domain.com/ 을 필요로하는 당신이 http://domain.com/agents/subdomain/를 표시하는 경우
여기까지 있습니다.
RewriteEngine On
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{HTTP_HOST} !^(www\.)?domain\.com [NC]
RewriteCond %{HTTP_HOST} ([^\.]+)\.domain\.com [NC]
RewriteCond %{REQUEST_URI} !^/agents
RewriteRule ^(.*)$ /agents/%1/$1/ [L]
URL에서 index.php를 없애려면 첫 번째 규칙이 필요합니다.
첫 번째 작품은 http://subdomain.domain.com/이지만 서브 폴더는 만들 수 없습니다.
위의 구문은 내부 서버 오류를 던지고하지만 난에 마지막 줄을 변경할 경우 : I 하위 디렉토리를 얻을 수없는 것을 제외하고
RewriteRule ^$ /agents/%1/$1/ [L]
그것을 작동합니다.