2009-03-08 3 views
0

현재 PHP로 하위 도메인 와일드 카드를 해석 중이며 .htaccess와 함께 처리하고 싶습니다. 사용자 프로필은 http://username.mysite.com/ (또는 일부 사용자의 경우 http://www.username.mysite.com/)에서 액세스 할 수 있습니다. main.php? action = profile기본 .htaccess에 대한 도움말 mod_rewrite

가장 어려운 부분은/error/i + am + a + test + 메시지 또는 /files/iamatestfile.jpg입니다. & 오류 = i + am + a + test + 메시지 또는 & 파일 = iamatestfile.jpg

모든 도움에 감사드립니다!

답변

2

시도 :

RewriteRule ^error/(.*) index.php?error=$1 [L] 
RewriteRule ^file/(.*) index.php?file=$1 [L] 

... 마지막 두.

+0

내가 먼저 하위 도메인에 대한 COND을 가지고 있는지 확인해야 그 파일을로드하기 전에 그 하위 도메인에있는 다른 다음 WWW. –

+0

음 ... 예 ... RewriteCond 지시어를 각 규칙 앞에 한 번 두 번 넣으십시오. –

+0

예, RewriteCond % {HTTP_HOST}!^www \ .mysite \ .com $ [NC]를 각각 추가하십시오. – cdmckay

0

이 시도 :

# stop rewriting for the host names example.com and www.example.com 
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ 
RewriteRule^- [L] 

RewriteRule ^error/(.*) index.php?error=$1 [L] 
RewriteRule ^file/(.*) index.php?file=$1 [L] 
+0

와일드 카드 하위 도메인은 무엇인가요? 그 것에 대한 cond/rule 예제를 보여줄 수 있습니까? 오류/파일 대신 동적 인 (. *)/(. *)/변수/값/변수 2/값 2와 비슷합니다. 감사! –