I'm trying to get a specific .htaccess rewrite done, but my regex skills are limiting me to do so;
example 1: www.domain.com/dir1/dir2/dir3/file.txt should become www.domain.com/dir1/dir2/file.txt
example 2: www.domain.com/dir1/dir2/dir3/dir4/file.txt should also become www.domain.com/dir1/dir2/file.txt
example 3: www.domain.com/dir1/dir2/dir3/dir4%2Ffile.txt should also become www.domain.com/dir1/dir2/file.txt
And so on. As I do not know on forehand what dir2, dir3, dir4, and so on will be, regex probably should be used. Also, I do not know on forehand how deep the directories will go (if there will be a dir3, dir4 or even dir5 at all). Urlencoded slashes also should be recognized. Using php to handle this is not an option.
Any help would be GREATLY appreciated!
dir1
?