I have a problem with a link in a newsletter. The link point to a file (.wav) who is on the server but when I click on it on the newsletter I got an http 400 error, which means the file is missing. But it is on my server.

I've tried to make a redirection to another file (.zip) The redirection doesn't work but I can download the file.

My file is called like that: trak(Extended_Intro+Outro).wav

and the zip is: track.zip

My htaccess looks like that:

AddType audio/x-wav .wav
AddType audio /wav .Wav
AddType application/octet-stream .wav

Redirect 301 /newsletter/music/track(Extended_Intro+Outro).wav 

http://mysite/newsletter/music/track.zip

What I am doing wrong?

Thanks for help.

Regards

link|improve this question
2  
http 400 is actually "bad request" – Cyclone Sep 13 '11 at 21:53
2  
I think the formatting of your AddType is wrong: remove the excess spacing on the second line. – U4iK_HaZe Sep 13 '11 at 22:27
@U4ik_Haze: yes, that "audio /wav" is wrong. should be "audio/wav". – Craig Sanders Sep 14 '11 at 9:44
feedback

migrated from stackoverflow.com Sep 13 '11 at 22:04

This question came from our site for professional and enthusiast programmers.

2 Answers

i'm having a hard time trying to figure out what it is you're actually trying to do.

you want to redirect a request for a specific .wav file to a specific .zip file? or the other way around?

in either case, why? they're different types of files, not really interchangable.

As for the htaccess problem, do you have:

  • AccessFileName defined in your apache config?

see: http://httpd.apache.org/docs/2.2/mod/core.html#accessfilename and http://httpd.apache.org/docs/2.2/howto/htaccess.html

  • AllowOverride configured for the directory concerned?

    You need FileInfo allowed for AddType and Redirect to work in a .htaccess file.

    Watch our for "AllowOverride None" in a higher level dir - that disables htaccess settings for the directory and all subdirectories (but will be overridden by more specific AllowOverride rules that are defined for subdirectories)

see http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

link|improve this answer
Thanks for reply. I've updated the htaccess without the space but it doesn't anything unfortunately. Regards – design1 Sep 13 '11 at 22:48
what's a space got to do with anything i wrote? – Craig Sanders Sep 13 '11 at 23:44
feedback

What I try to do is to redirect a request to a .wav file to a specific .zip file.

The server is checking my htaccess for sure (cause I can get for example an error 500 if I put random code in my htaccess).

So what Im trying to do is to redirect my .wav to a zip file. Is that possible?

Regards

link|improve this answer
yes, it's possible. see the stuff i wrote in my answer above about AllowOverride. – Craig Sanders Sep 14 '11 at 9:44
I've just tried to add AllowOverride All but got an error 500. Any ideas? – design1 Sep 14 '11 at 9:57
feedback

Your Answer

 
or
required, but never shown