要么我真的需要回到学校的办公桌,要么有一些奇怪的事情发生。.htaccess重写问题
下不起作用,因为真正的物理文件和目录没有解决:
<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?
我非常感谢这个出色的答复和解决方法。 – tim
非常欢迎您,很高兴您喜欢这种解决方法。 – anubhava