0
我正在使用緩存清除引擎,用於基於PHP和.htaccess的CSS和JS腳本。因此,在PHP我建了以下功能:.htaccess和mod_rewrite條件
function CreateFileFingerprint($RelativePath)
{
$PathInfo = pathinfo($RelativePath);
return $PathInfo['dirname'].'/'.$PathInfo['filename'].'.'.filemtime(DATA_BASEPATH.$RelativePath).'.'.$PathInfo['extension'];
}
雖然在我的.htaccess我使用過期頭:
FileETag None
Header Unset ETag
ExpiresActive On
ExpiresDefault A2592000
ExpiresByType application/javascript A31536000
ExpiresByType text/css A31536000
ExpiresByType text/javascript A31536000
<FilesMatch "[^\.php]$">
Header Append Cache-Control "public"
</FilesMatch>
還有一點的mod_rewrite規則:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(css|js)$ $1.$3 [L]
然後在我的PHP第I頁使用以下代碼:
echo '<link rel="stylesheet" href="'.self::CreateFileFingerprint('/styles/style-base.css').'" media="all"/>';
一切工作正常,但現在我想爲我的網站實現一個通用的PHP ErrorDocument像解釋here。問題是,我需要合併我以前的mod_rewrite規則與一個在鏈接提示:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /errors/error.php [L]
有人能幫助我嗎? 非常感謝!
這是行不通的。 Apache終止於500。 –