Solved

How to get my .htaccess working?

Posted on 2014-11-21
4
153 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 51

Expert Comment

by:Steve Bink
ID: 40459544
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
ID: 40460664
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 51

Accepted Solution

by:
Steve Bink earned 500 total points
ID: 40460922
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
ID: 40461765
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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

734 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