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 was trying to redirect the users to see a default image instead of a missing image. In addition to this, I wanted to try if I could change 200 HTTP response status code to 206 and still show the default image. I tried RewriteRule with [R=206,L] but it's showing an HTML document pertaining to 206 response.

Is this possible?

share|improve this question
    
This is for apache. –  Jojo Siao Jan 26 '12 at 5:57

1 Answer 1

Yes to the first one, no to the second one. A 206 response can only be sent when partial content is being sent in response to a Range request. I'm wondering why you'd want to do this?

Anyway, the image thing is doable - put this in a <Directory> block for your docroot.

RewriteEngine On
RewriteCond %{REQUEST_URI} \.(jpg|gif|png)$ [NC] # Add any other image filetypes you need
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ default_image.jpg [L]
share|improve this answer
    
I have done that but my problem is to force apache to throw 206 but still show the default image. It seems that this is a limitation of apache web server. Apache sends out html documents, saying what happened to the HTTP request. –  Jojo Siao Jan 26 '12 at 6:24
    
Sending a 206 is not allowed. You cannot send it when responding to a non-partial request. Can you explain why you would want to send a 206? –  Shane Madden Jan 26 '12 at 6:33

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.