Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 168
  • Last Modified:

How to get my .htaccess working?

Hi,

I have this very simple .htaccess file that should cache files and set connection to keep-alive. My server provider allow .htaccess but with this file, it doesn't work and I get error 500. So please what should I add or change?

And also am I right with assumption that I need only the first Filematch condition?

Bellow is my whole short .htaccess file

<FilesMatch "\.(html|htm|js|css|jpg|jpeg|gif|png|ico)$">
    #FileETag None
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault "access plus 2 weeks"
    </IfModule>

</FilesMatch>

# Generated JavaScript caching

<FilesMatch "(.*).js">
    <IfModule mod_expires.c>
        ExpiresActive On
        ExpiresDefault "access plus 2 weeks"
    </IfModule>
</FilesMatch>

<ifModule mod_headers.c>
    Header set Connection keep-alive
</ifModule>
0
Fajer39
Asked:
Fajer39
  • 2
1 Solution
 
Steve BinkCommented:
Have you verified it is the .htaccess file causing the 500?  If so, you'll need to access the server's logs to get an idea what it is complaining about.  The only other method is to comment out the file, and re-enable it line-by-line....when you start getting the error again, that line is the one causing it.
0
 
Fajer39Author Commented:
Ok I tried, but it doesn't work so I contacted the client's hosting support. Anyway this code above should normally work right? And yes, when I upload .htaccess it gets error 500, when i remove it it's fine.
0
 
Steve BinkCommented:
As far as I can tell, it looks fine.  I tried it on my own server, and was able to see the Header added, at least, and did not receive a 500 response.  You'll need to get more information from your host.
0
 
TimorosCommented:
Try removing commands one by one to check which one causes the 500 error.
A wild guess is the <ifModule mod_headers.c> !
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now