Redirect with .htacess - URL with regex to URL

Posted by nicorellius on Super User See other posts from Super User or by nicorellius
Published on 2013-10-23T19:24:28Z Indexed on 2013/10/23 21:56 UTC
Read the original article Hit count: 337

Filed under:
|
|

I have a temporary need to redirect some installer files on my web site. The redirects that are working now look something like this:

Redirect 301 /installer_1.0.0.zip http://www.example.com/download/installer_1.0.3.zip
Redirect 301 /installer_1.0.1.zip http://www.example.com/download/installer_1.0.3.zip
Redirect 301 /installer_1.0.2.zip http://www.example.com/download/installer_1.0.3.zip

I would like to use a regex instead of having multiple lines for each version I need to redirect. I have tried these options with no success:

Redirect 301 /installer_(.*).zip http://www.example.com/download/installer_1.0.3.zip
Redirect 301 /installer_([0-9+]\.[0-9+]\.[0-9+]).zip http://www.example.com/download/installer_1.0.3.zip

Should these work or am I doing something wrong?

Thanks.

© Super User or respective owner

Related posts about regex

Related posts about redirection