I am using apache2 server running on debian which forwards all the http request to tomcat installed on same machine.
I have two files under my /etc/apache2/ folder
apache2.conf and httpd.conf
I modified httpd.conf file to look like following.
I want to achieve following.
- forward all traffic to tomcat
- GZIP all the text content.
- Put 1 week expiry header to all static files and unset ETag/last modified header.
- rewrite all js and css file to certain format.
- remove all the query parameters from URL
- forward all www.example.com to example.com
The problem is only 1 and 2 are working. I tried a lot with many combinations but the expire and rewrite rule (3-6) do not work at all. I also tried moving these rules to apache2.conf and .htaccess files but it didn't work either. It does not give any error but these rules are simple ignored.
expires and rewrite modules are ENABLED.
Please let me know what should I do to fix this. 1. Do I need to add something else in httpd.conf file (like Options +FollowSymLink) or something else? 2. Do I need to add something in apache2.conf file? 3. Do I need to move these rules to .htaccess file? If yes, what should I write in that file and where should I keep that file? in /etc/apache2/ folder or /var/www/ folder? 4. Any other info to make this work?