sergeychernyshev/.htaccess

Strip date and version number from vbulletin 4 js & css files.

Closed this issue · 5 comments

Ok, I've had a look at it & here's my thoughts. I'd like to get this part working with vbulletin 4.
Here is how the files look after vbulletin processes them.
/forum/clientscript/vbulletin-core.js?v=420
/forum/clientscript/vbulletin_css/style00021l/additional.css?d=1358449816

The problem is that during testing with it enabled it's not stripping the date from css files, also it would be good if it stripped the version number from js as well. Any suggestions to help get this working properly?

----------------------------------------------------------------------

Enabling filename rewriting (file.XXX.ext) if URL rewriting is enabled

Otherwise URLs will use query strings (file.ext?v=XXX)

More proxies cache assets if there is no query string

----------------------------------------------------------------------

RewriteEngine On

Setting up an environment variable so your code can detect if mod_rewrite rules are executable

in this folder and you can use file.123.jpg or you need to fall back to file.jpg?123

RewriteRule . - [E=URLVERSIONREWRITE:YES]

Rewrites a version in file.123.jpg as well as timestamped version file.123_m_12345123512354.jpg

to original file.jpg so you can use it instead of file.jpg?123 which isn't cached in some proxies.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*).(\d+)(m\d+)?.([^.]+)$ $1.$4 [L,QSA]

Rewrites a version in file.ac123fe.jpg to original file.jpg

so you can use it instead of file.jpg?123 which isn't cached in some proxies.

Used for hash-based URLs where having a timestamp is not necessary.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*).([a-z\d]+).([^.]+)$ $1.$3 [L,QSA]

Sorry, it is not clear what you're trying to do and why it applies to .htaccess project, can you give more background?

In short I would like to have advice on how to rewrite these urls

/forum/clientscript/vbulletin-core.js?v=420
/forum/clientscript/vbulletin_css/style00021l/additional.css?d=1358449816

to this:

/forum/clientscript/vbulletin-core.js
/forum/clientscript/vbulletin_css/style00021l/additional.css

Are you trying to put infinite expiration for these?

/forum/clientscript/vbulletin-core.js?v=420
/forum/clientscript/vbulletin_css/style00021l/additional.css?d=1358449816

Ignoring query strings for static files is default server behavior, not sure why do you need to rewrite things?

I am trying to make them cacheable, as when I test it in gtmetrix, yslow, pingdom or webpage test it always reports back that:

"Resources with a "?" in the URL are not cached by some proxy caching servers. Remove the query string and encode the parameters into the URL for the following resources:"

Here is one such report.
http://gtmetrix.com/reports/www.video-game-chat.com/ZU4hYWOY

Well, mod_rewrite can't help you there - you need to do that within VBulletin.