I read in the modpagespeed documentation that it's possible to enable mod_pagespeed in .htaccess file but is not recomended and the other section is Enabling the PageSpeed in the entire virtual host like this:
ModPagespeed On
ModPagespeedInheritVHostConfig on
ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"
ModPagespeedEnableFilters combine_css,combine_javascript
# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /www/example1
ServerName www.example1.com
ModPagespeedMapRewriteDomain cdn.example1.com *example.com
</VirtualHost>
My Question is: Can I enable pagespeed in a specific directory inside the virtual host instead of the entire virtual host sites?
like this:
<VirtualHost XXX.XXX.XXX.XXX:80>
SuexecUserGroup "#1001" "#1001"
ServerName DOMAIN.com
ServerAlias www.DOMAIN.com
ServerAlias mail.DOMAIN.com
ServerAlias webmail.DOMAIN.com
ServerAlias admin.DOMAIN.com
DocumentRoot /home/DOMAIN/public_html
<Directory /home/DOMAIN/public_html/demo-site/demo-2-site>
AllowOverride Fileinfo Options
#============= Something like that ==============
ModPagespeed On
ModPagespeedInheritVHostConfig on
ModPagespeedFileCachePath "/var/cache/mod_pagespeed/"
ModPagespeedEnableFilters combine_css,combine_javascript
# Direct Apache to send all HTML output to the mod_pagespeed
# output handler.
AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
</Directory>
</VirtualHost>