2009-03-03 61 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 

“只有使用下面的规则,如果请求不符合现有的文件或目录。”