Solved

How to get my .htaccess working?

Posted on 2014-11-21
4
145 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
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 50

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

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). #…
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 a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

821 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