My name’s Gabriel and I’ve had a drink problem for 80 years... [er, sorry wrong forum]
I’m very new to MODx and so far loving it. I got a question though - normally when I cobble together sites I like to have an htaccess rewrite rule that allows me to add a version number to the CSS file in the HTML Head, ie [tt]@import url(/_css/style.234.css);[/tt] - while leaving the file on the server as [tt]style.css[/tt]. This means I can keep track of any changes with Git and make sure that changes get out to repeat visitors. (I also tend were possible to add caching via .htacess too.)
I’ve successfully moved into MODx for basic content management but my normal CSS versioning rewrite rule (below) doesn’t work.
[tt]RewriteRule ^_css/style\.(\d+)\.css$ _css/style.css [L][/tt]
Does anybody have any idea why this might be?
Many thanks in advance.
.. and hello, properly, from this corner of Andalucia
-
☆ A M B ☆
- 2,475 Posts
This is really an .htaccess question not a MODx question. Do you have friendly URLs enabled? In other words, are you using MODx’s .htaccess file? And are they working? A good way to check to see if your .htaccess file is being properly parsed is to temporarily put some junk at the front of the file, e.g. "asdfasdfasd" and save it... if you visit your site and get a server error, then you know the file is being parsed.
I’d recommend trying an .htaccess file that ONLY contains this information and see if you can’t get the behavior you want on a static page. If that works... then I’d try adding that to the MODx .htaccess file, placing this rewrite rule in different places in the file ... e.g. try it before or after the MODx stuff and see if it makes any difference.
Hope this helps.
Thanks so much! You’re absolutely right; it wasn’t a MODx issue but an .htaccess one. I just needed to move that line up to before the MODx rules. Friendly URLs and versioned CSS. I’ll buy you a beer next time your round these parts. Thanks again.
Gabriel
-
☆ A M B ☆
- 2,475 Posts
Cheers! Glad that worked. Maybe the MODx forums should get those Facebook style apps "Buy Someone a Beer!"