要么我真的需要回到课桌,要么发生了一些奇怪的事情。
以下不起作用,因为实际的物理文件和目录无法解析:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
# The following rule must not affect real physical files, but does
RewriteRule ^(img/.*)$ http://old.site.com/$1 [L,R=301]
RewriteRule .* index.php [L]
</IfModule>
但是,这段代码可以正常工作并解析真实的文件和文件夹:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(img/.*)$ http://old.site.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
</IfModule>
我真的需要在每个 RewriteRule 之前都有一个新的 RewriteCond 吗?