What I hated in all rewriting and redirection rules for .htaccess files, they all rely on the hardcoding path (URI) and / or server for redirection.
The dot ".htaccess" will be files, it should be for the current directory! It can be referenced in several ways, installed on different servers in different places. Thus, trying to move it to a specific location to simply rename directories is illogical.
The solution is to somehow include the current URI (no matter where the .htaccess location is ...)
This is my current solution for location-independent ".htaccess" redirects for a renamed subdirectory, and even I admit that this is not perfect ... BUT IT WORKS ...
Options +FollowSymLinks RewriteEngine On RewriteRule ^OLDdir/.*$ %{REQUEST_URI}::: [C] RewriteRule ^(.*)/OLDdir/(.*)::: $1/NEWdir/$2 [R,L]
anthony
source share