Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to get my .htaccess working?

Posted on 2014-11-21
4
Medium Priority
?
163 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 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

671 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