问题描述
林安装phpancake,有一个文件夹有玛像这样
应用程序/
安装/
图书馆/
上市/
sql_schema /
的Install.html
install.php了
这是什么规则呢?
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME -s [OR]
的RewriteCond%{} REQUEST_FILENAME -l [OR]
的RewriteCond%{} REQUEST_FILENAME -d
。重写规则^ * $ - [NC,L]
重写规则^ * $ /vote/public/index.php [NC,L]
重写有两个部分。第一个规定,如果被请求的文件名是一个大小的常规文件大于0( -S
),一个符号链接( -l
)或目录(<$ C C> -d ),改写无门,例如。不采取任何行动。 [NC,L]
表示,该规则是不区分大小写的最后一条规则是,这些条件相匹配。
所有其他请求转发到 /vote/public/index.php
。
此改写的目的是,实际的,现有的文件可以从服务器无干扰取出。如果没有第一个规则,每个文件请求(CSS和JS文件,图像等)将转到的index.php
这会搞乱了pretty的厉害。
通常这是写在一个声明,虽然。你可以否定的条件,然后在 [OR]
statemens可以取出来也:
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-s
的RewriteCond%{} REQUEST_FILENAME!-l
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^ * $ /vote/public/index.php [NC,L]
这是相当于原来的语句。
Im installing phpancake,there is a folder there shema like this
application/
install/
library/
public/
sql_schema/
install.html
install.php
What does this rule mean?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /vote/public/index.php [NC,L]
The rewrite has two parts. The first one specifies that if the requested filename is a regular file with a size greater than 0 (-s
), a symbolic link (-l
) or a directory (-d
), rewrite to nowhere, eg. take no action. [NC,L]
means that the rule is non case sensitive and the last rule that these conditions match.
All other requests are forwarded to /vote/public/index.php
.
The purpose of this rewrite is that an actual, existing file can be fetched from the server without interference. Without the first rule, every file request (css and js files, images etc) would go to index.php
which would mess things up pretty badly.
Usually this is written in one declaration, though. You can negate the conditions, and then the [OR]
statemens can be taken out also:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /vote/public/index.php [NC,L]
This is equivalent to the original statement.
这篇关于这是什么重写规则是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!