0

I want to append a static query string to all css files on my site. Like styles.css to styles.css?a=1. Is it possible to achieve this through rewrite rules in .htaccess file. If so what's the rewrite rule to be written. thanks in advance. .

4

1 回答 1

3

将此添加到您网站根文件夹下的 .htaccess 文件中,这会将所有 css 请求重定向到 css?a=34(用户浏览器中显示的查询),这是您想要的吗?

<IfModule mod_rewrite.c>
 RewriteEngine On 
 RewriteBase /
 RewriteCond %{QUERY_STRING} ^$
 RewriteRule ^(.+)\.css$ $1.css?a=34 [R,L]
</IfModule>
于 2013-03-20T03:48:33.920 回答