2010-08-03 1 views
0

내 사이트는 4 개 국어에 있고 그들은 다음과 같은 패턴으로 액세스 할 수 있습니다 : 내 htaccess로 파일에 다음 mod_rewrite를 규칙을 사용하고mod_rewrite는 en, es가 있지만 zh-tw 및 zh-cn이 아닌 URL에 사용할 수 있습니까?

http://example/index.php?lang=en 
http://example/index.php?lang=es 
http://example/index.php?lang=zh-tw 
http://example/index.php?lang=zh-cn 

: 그래서

RewriteEngine on 
RewriteRule ^([a-z]{2}(-[A-Z]{2})?)/(.*) $3?lang=$1 [L,QSA] 

http://example/en/index.phphttp://example/es/index.php을 입력하면 각각 http://example/index.php?lang=enhttp://example/index.php?lang=es으로 유효하게 리디렉션됩니다. 하지만 그 http://example/index.php?lang=zh-twhttp://example/index.php?lang=zh-cn

작동하지 않습니다 그냥 말한다 : The requested document was not found on this server.

그것은 하이픈 (에서 zh-TW과에서 zh-CN) 함께 할 수있는 뭔가가있다?

이 문제를 어떻게 해결할 수 있습니까?

답변

2

[A-Z][a-z]으로 바꿉니다.

+0

예 감사드립니다. 그럼 전방에서 [a-z]를 삭제할 수 있습니까? – alexchenco

+1

@ janoChen 아니요, 계속하십시오. 하이픈보다 먼저 부분을 잡아내는 것은 여전히 ​​필요합니다. – Maerlyn

관련 문제