I'm redirecting my root to a subdirectory on my server:
RewriteEngine On
RewriteRule ^(.*)$ /_from_git/$1 [L]
In that subdirectory (_from_git
/) will also be .htaccess files with redirects. I want my like below redirects to be exact matches using the start (^
) and end ($
) selectors, but I don't want to have to include ^_from_git/
in every rewrite.
So my question is - How can I modify my root redirect above, so my subsequent redirects can be like this:
^old_page\.html$ /new_page.html [R=301,L]
and not like this:
^_from_git/old_page\.html$ /new_page.html [R=301,L]
Thanks!
If you create a /_from_git/.htaccess
file then you can have these rules without the need to prefix each rule pattern with /_from_git/
:
RewriteEngine On
RewriteRule ^old_page\.html$ /new_page.html [R=301,L,NC]