要麼我真的需要回到學校的辦公桌,要麼有一些奇怪的事情發生。.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