'How to redirect the existing URL to new URL

I have a simple html website and in app folder I have a file called application_14.apk now I have sent the download link of this application to my users, later I uploaded this apk on S3 bucket then I changed the anchor tag link to s3 link.

Now I want that whenever any user navigate to https://app.starmarketingonline.com/app/application_14.apk it should not download the file and must redirect to this link https://attandence-bucket.s3.us-east-2.amazonaws.com/applicationVersions/application.apk

I have hosted this site on cPanel and it does not use any serverside language.

Attached below is my htaccess file.

RewriteEngine on

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php73” package as the default “PHP” programming language.
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php73 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit


Options +FollowSymLinks
RewriteEngine On
RewriteRule ^app/application_14.apk$ https://attandence-bucket.s3.us-east-2.amazonaws.com/applicationVersions/application.apk [R=301,L]

Please help me out.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source