这个RewriteRule意味着什么?

时间:2015-01-15 09:35:20

标签: apache .htaccess mod-rewrite

我已经在我的服务器上安装了WordPress多站点,并且我遇到了麻烦,因为由于某种原因没有读取存在的CSS文件,并且该文件的URL完全正确。

由于这个问题,我尝试了解.htaccess文件的作用,并且我已经堆叠到此RewriteRule

RewriteRule ^ - [L]

我知道-[L]的作用,但我无法理解^的作用。

以防万一,.htaccess文件中的预览行如下:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d

1 个答案:

答案 0 :(得分:1)

这是"在所有情况下的简写"。主要用于RewriteCond之前。

示例:

# skip all files and directories from rewrite rules below
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

所以,在这种情况下什么都不做。

相关问题