0

This is our 1st attempt with .htaccess scription. Please help us with the below requirement:

Actual URL: https://domaina.com/Criteria1/valueaddedcourse/2202223742-first aid course.pdf

If the URL Contains "/Criteria1/valueaddedcourse/" then it should redirect to a new domain & path but with same file name (2202223742-first aid course.pdf)

https://qaanr.s3-ap-south-1.amazonaws.com/2202223742-first aid course.pdf

Being a newbie, find apache tutorial too cryptic (https://httpd.apache.org/docs/2.4/howto/htaccess.html)

Please do share content with details description for .htaccess - this will help us to learn.

==== Update to above question ===

this code works for me:

` RewriteEngine On RewriteCond %{REQUEST_URI} ^/Criteria1/valueaddedcourse/ RewriteRule ^(.*) https://qaanr.s3-ap-south-1.amazonaws.com/% {REQUEST_FILENAME} [P]

`

this code works for redirection, Fails to mask. Browser has to show the original domain name & not https://qaanr.s3-ap-south-1.amazonaws.com/

  • Welcome to SO, please do add your tried htaccess rules file in your question, thank you. – RavinderSingh13 Aug 26 '22 at 14:18
  • RewriteEngine On RewriteCond %{REQUEST_URI} ^/Criteria1/valueaddedcourse/ RewriteRule ^(.*) https://qaanr.s3-ap-south-1.amazonaws.com/%{REQUEST_FILENAME} [P] this code works for redirection, Fails to mask. It has to display the original domain name & not https://qaanr.s3-ap-south-1.amazonaws.com – TwoT Technologies Aug 26 '22 at 16:04

1 Answers1

0

RewriteEngine on

RewriteCond %{REQUEST_URI} ^/Criteria1/valueaddedcourse/

RewriteRule ^(.*)$ https://qaanr.s3-ap-south-1.amazonaws.com/$1 [R=301,L]

Usage = If the URL Contains "/Criteria1/valueaddedcourse/" then it will redirect to a new domain & path but with same file name (2202223742-first aid course.pdf)

  • This did not work. Error message: NoSuchKey The specified key does not exist. /home/anracin/domains/anr.ac.in/private_html/Criteria1 DVYW11DK0HTYHMP9 W8En1R4vqbss4aUT/MXMB1IzyphgRM8e0YfWXKaN2RCJoWTK1Nc609KT1YmZAUa2ApFN33GRz5c= – TwoT Technologies Aug 27 '22 at 14:57