1

我读过一些代理不使用“?”缓存资源。在他们的 URL 中查询。参考

有没有办法让参数成为文件名的一部分?

(我猜这意味着将 style.css?v=123456 变成 style.123456.css)

4

1 回答 1

2

是的 - 有这样的参数称为:versionNumberInFilename。您可以在 InstallTool->All Configuration 或在typo3conf/localconf.php 中手动设置它们

Take care that there is such parameter for BE (backend) and separete for FE (frontend)

For backend you need to set it to "1". So finally in you typo3conf/localconf.php file there will be added line:

$TYPO3_CONF_VARS['BE']['versionNumberInFilename'] = '1'

For frontend you need to set it to "embed". So finally in you typo3conf/localconf.php file there will be added line:

$TYPO3_CONF_VARS['FE']['versionNumberInFilename'] = 'embed';

Then make sure the lines below are in your .htaccess so the files with numbers inside are properly resolved. In the latest versions of TYPO3 its by default active.

# Rule for versioned static files, configured through:
# - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
# - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
于 2012-09-07T11:35:10.047 回答