Redirect example.com/uplaod/*/*/*.zip to example.com/down.php?file=*.zip

How to redirect by .htaccess example.com/uplaod/2009/10/test.zip to example.com/test.php?file=test.zip

This is work:

Read More
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^uplaod/(.*)$ http://example.com/test.php?file=$1 [R=301,L]

But, I need only redirect special file extension (zip,7z & rar), and other files will not redirect.

Also I need to remove other folder name after upload (year & month), and only file name on output.

Related posts

Leave a Reply

1 comment

  1. You can use this rule:

    Options +FollowSymLinks
    RewriteEngine On
    RewriteRule ^uplaod/[0-9]{4}/[0-9]{2}/(.+?.(?:zip|7z|rar))$ /test.php?file=$1 [R=301,L,NC]