1

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

2 Answers2

2

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
mgorven
  • 30,036
  • 7
  • 76
  • 121
0

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.

DukeLion
  • 3,239
  • 1
  • 17
  • 19
  • 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 http://www.lujanventas.com/404.php. The problem is not with file extension. – DukeLion May 18 '12 at 20:00