2009-03-03 113 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 – 2009-03-03 19:10:57

回答

0

簡單的答案:這些聲明重寫每個請求到rewrite.php文件。

更全面的答案:RewriteCondRewriteRule指令來自Apache module mod_rewrite並提供基於規則的URL重寫機制。

看來,這些規則是爲了重寫每個請求到rewrite.php文件,無論是在一個特定的目錄(/~foobar的/rewrite.php)或根(/rewrite.php)。

0

它是一個Apache mod_rewrite規則。除非你使用某種框架,否則你可能不需要它。有關更多信息,請參閱Apache mod_rewrite。

1

這些說

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

「只有使用下面的規則,如果請求不符合現有的文件或目錄。」