PDA

View Full Version : Apache - how to serve&display foofic.jpg if 'img src=foopic'


Mika
Mon 3rd Nov '03, 4:05am
I switched from Apache 1.3.x to Apache 2.0.x and now I'm having a weird problem. I have an application which allows users to upload pictures. They can then post a message where they can use that picture.

Problem is that sometimes they upload foopic.jpg but then they use that in html as <img src="foopic">. ie. without a file extension.

Previously when I used apache 1.3 everything worked just fine. (I didn't even notice that some references to those picture files in mysql database were without file extensions). (Note... picture itself isn't stored in the database. Just the filename)

Now Apache 2.x doesn't display those images but instead error_log shows:
File does not exist: /usr/local/apache2/htdocs/images/foopic

I have tried mod_speling but it doesn't work.
Any ideas?

Steve Machol
Mon 3rd Nov '03, 11:30am
I wonder if this is the same problem that was reported a long time ago with Apache 2:

http://www.vbulletin.com/forum/showthread.php?t=60591

Mika
Thu 6th Nov '03, 6:14am
Solution:

<IfModule mod_alias.c>
RedirectMatch reviews\/images\/(\w*)$ http://www.mysite.com/reviews/images/$1.jpg
</IfModule>

So this works but are there any problems if I use this.. performance etc?