In .htaccess
the URL-path that is matched by the RewriteRule
pattern does not start with a slash. So, the regex should be ^rg$
, not ^/rg$
. In other words:
RewriteRule ^rg$ /download/file_1.pdf [NC,L]
Specifically, the directory-prefix that leads to the .htaccess
file is first removed from the requested URL-path before the match occurs. This directory-prefix always ends with a slash, so the URL-path never starts with a slash.
This contrasts to when the directive is used in a server (or virtualhost) context, when you do need the slash prefix, since it matches the full URL-path (there is no directory-prefix in a server context).