I found the following htacess that allows concatenation from within specific js files
<FilesMatch "\.combined\.js$">
Options +Includes
AddOutputFilterByType INCLUDES application/javascript application/json
SetOutputFilter INCLUDES
</FilesMatch>
e.g. Inside of script.combined.js you could have
< !--#include file="libs/jquery-1.5.0.min.js" -->
< !--#include file="plugins/jquery.idletimer.js" -->
and they would be included into this single file.
I want to know how do these two line – line 2 n 3 of the .htaccess combine files.
Also these have worked on several systems but on my ubuntu 12.04 with Apache 2.2.22 they don’t work. why?
The first line enables Includes also known as SSI (server-side includes) for the two mime types:
application/javascriptandapplication/jsonThe second line
SetOutputFilter INCLUDESprocesses the files for includes before outputing them but only for the files contained in the regex path"\.combined\.js$"and basically does what the first is doing but it’s a backup.Your missing a crucial
Optionflag. And that’sOptions +Includesto enable includes to begin with. That may be why it is not working on the other serverI hope your not including that space after the
<and it was a typo because surely that will not work on any version of apache if I’m not mistaken. It should be without spaces as follows:You will also need to enable
mod_includemodule in your Apache httpd.conf. http://httpd.apache.org/docs/2.2/mod/mod_include.htmlLoadModule include_module modules/mod_include.soI’m pretty sure you got this code from the HTML5-Boilerplate .htaccess
https://github.com/h5bp/html5-boilerplate/blob/master/dist/.htaccess#L887-L917