At the root of the web server are audio files. Files can be in wav or mp3 format. I am trying to redirect to a file with the same name, but with a different extension. For example, if there is no file with the name hello.wav, redirect to hello.mp3. My attempts were on the example of one answer about html and php. Please correct me!
Server version: Apache/2.4.25 (Debian 9.8)
my .htaccess:
Options -Indexes
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*).wav$ $1.mp3 [L]
For example, if there is no file with the name hello.wav, redirect to hello.mp3. in browser i am write http://domain.kz/hello.wav and should get http://domain.kz/hello.mp3
2
Answers
I made a simple mistake in not having completely checked all the settings of the web server. I turned on the modules "rewrite" and "userdir"
and edited AllowOverride for /var/www/
and restart apache
I don’t know if your problem is solved, but I found a lead that might help you.
https://httpd.apache.org/docs/2.4/en/rewrite/flags.html#flag_s