I'm trying to redirect from an URL like this:
https://example.com/images/qr/brochure.pdf
to the home page of the site: https://example.com
I tried using this code in a .htaccess
file, and added the file in the same folder as the brochure:
RewriteEngine On RewriteRule ^ brochure.pdf$ https://example.com/[R=301,L,NC]
but this only makes the brochure link act as if it doesn't exist but doesn't redirect it to home.
I also tried a couple of other codes that generate a 500 error on the page, so this is the closest I have gotten.
Also, if there is any other solution for this problem let me know, it doesn't have to be exactly on .htaccess
/images/qr/brochure.pdf
) exist? What other.htaccess
files do you have and what other directives? Why are you using a.htaccess
file in that subdirectory and not the root?