Solved

How to get my .htaccess working?

Posted on 2014-11-21
4
136 Views
Last Modified: 2014-11-24
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
Comment
Question by:Fajer39
  • 2
4 Comments
 
LVL 50

Expert Comment

by:Steve Bink
Comment Utility
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
 
LVL 1

Author Comment

by:Fajer39
Comment Utility
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
 
LVL 50

Accepted Solution

by:
Steve Bink earned 500 total points
Comment Utility
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
 
LVL 8

Expert Comment

by:Timoros
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you are running a LAMP infrastructure, this little code snippet is very helpful if you are serving lots of HTML, JavaScript and CSS-related information. The mod_deflate module, which is part of the Apache 2.2 application, provides the DEFLATE…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now