Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I just moved to a new server. All my site is including images without extensions. () but the new server doesn't seem to recognize this files unless I add each file's extension which I don't know so I need it to work without the extension.

Example: http://lujanventas.com/test.php

What can be the reason for the images not showing? And what can I do to make them work?

% curl http://lujanventas.com/test.php
<html>
<body>
No extension:</br>
<img class="itemImage" src="/uploads/thumbs/619-0"></br>
With extension:</br>
<img class="itemImage" src="/uploads/thumbs/619-0.jpg"></br>
</body>
</html>

% curl -I http://lujanventas.com/uploads/thumbs/619-0
HTTP/1.1 302 Found
Location: http://www.lujanventas.com/404.php

% curl -I http://lujanventas.com/uploads/thumbs/619-0.jpg
HTTP/1.1 200 OK

The service provider is MediaTemple and the server uses Apache

share|improve this question
1  
What webserver are you using? –  mgorven May 18 '12 at 19:03
    
I'm running Apache –  Lisandro Vaccaro May 18 '12 at 19:11

2 Answers 2

up vote 2 down vote accepted

You want to enable MultiViews content negotiation, which makes Apache select an appropriate representation of a resource. The following directive in .htaccess or an appropriate <Directory>, <Location> or <Files> section should do that.

Options MultiViews
share|improve this answer

Apache is using file extension to determine file type and associate corresponding mime-type to Content-Type header.

You can also use SetHandler image/jpeg in .htaccess to force all file in this directory to be represented as image.

share|improve this answer
    
I don't understand, if Apache was determining the correct file type correctly wouldn't it show the images? That seems like a good solution. I created an .htaccess file on the /thumbs directory with only SetHandler image/jpeg as content but images are still not displayed. Was that what I was supposed to do? –  Lisandro Vaccaro May 18 '12 at 19:54
    
Your server answers to http://lujanventas.com/uploads/thumbs/619-0 request with 302 redirect to lujanventas.com/404.php. The problem is not with file extension. –  DukeLion May 18 '12 at 20:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.