2009-03-03 4 views
1

나는 PHP에 대한 신조어이다. 누구나 각 라인이 여기에서하는 것을 말해 줄 수 있습니까? 이게 필요한가요? 그것은 나에게 오류.htaccess 파일에서이 선언이 의미하는 것은 무엇입니까?

RewriteCond %{REQUEST_URI} /~([^/]+)/? 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*) /~%1/rewrite.php?p=$1&%{QUERY_STRING} [L] 
RewriteCond %{REQUEST_URI} /~([^/]+)/? 
RewriteRule ^index\.php?(.*)$ /~%1/rewrite.php?p=%1&%{QUERY_STRING} [L] 
#there is no ~ character in the URL 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*) ./rewrite.php?p=$1&%{QUERY_STRING} [L] 
RewriteRule ^index\.php?(.*)$ ./rewrite.php?p=$1&%{QUERY_STRING} [L] 
#WJ-180 fix 
RewriteRule ^resume\.php?(.*)$ ./rewrite.php?p=resume\.php$1&%{QUERY_STRING} [L] 
+0

PHP와 관련이 없으며, 이것은 Apache 구성 질문입니다. http://httpd.apache.org/docs/2.0/howto/htaccess.html –

답변

0

간단한 대답 :이 선언은 모든 요청을 rewrite.php 파일로 다시 씁니다.

보다 포괄적 인 대답 RewriteCondRewriteRule 지시문은 Apache module mod_rewrite에 있으며 규칙 기반 URL 다시 쓰기 메커니즘을 제공합니다.

이러한 규칙은 특정 디렉토리 (/~는 foobar/rewrite.php) 또는 루트 (/rewrite.php)에, 어느 쪽이든 rewrite.php 파일에 대한 모든 요청을 다시 작성하기위한 것입니다 것으로 보인다.

3

당신이 새로운 경우, http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html을 읽어 보시기 바랍니다 아주 잘 설명을주고있다.

p.s. 제목 "내 PHP .htaccess 파일에서 이러한 선언은 무엇을 의미합니까?" .htacces는 PHP 파일이 아닙니다.

0

Apache mod_rewrite 규칙입니다. 일종의 프레임 워크를 사용하고 있지 않다면 아마 필요하지 않을 것입니다. 자세한 정보는 Apache mod_rewrite를 참조하십시오.

1

이들은

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

"요청이 기존 파일이나 디렉토리를 일치하지 않는 경우에만 다음과 같은 규칙을 사용합니다."라고

관련 문제