Sublime Forum

My htaccess snippet does't work :(

#1

I have the following snippet for my .htaccess file , but it does’t work.

	<content><![CDATA[
<filesMatch ".(css|jpg|jpeg|png|gif|js|ico|woff)$">
Header set Cache-Control "max-age=2592000, public"
</filesMatch>
]]></content>
	<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
	<tabTrigger>ht-browser-caching</tabTrigger>
	<!-- Optional: Set a scope to limit where the snippet will trigger -->
	<scope></scope>
</snippet>```
0 Likes

#2

TL;DR: escape the $ with a preceding backslash

1 Like

#3

@kingkeith awesome :smiley: worked thanks … btw , if i add a .htaccess it does’t work again , any obvious issues with this ?

0 Likes

#4

I’m not quite sure what you mean, I’m afraid, can you clarify?

0 Likes

#5

@kingkeith sorry my bad … i mean if i add a scope it does’t work … like so:

<scope>.htaccess</scope>
0 Likes

#6

I’m guessing you are using https://packagecontrol.io/packages/ApacheConf.tmLanguage for syntax highlighting of .htaccess files?

In which case, the scope you need to use will be: source.apacheconf and not .htaccess. scope refers to a lexer scope as opposed to a file extension.

5 Likes