htaccess to redirect ANY request


two parts....

PART 1 - I want to redirect any request to a directory that DOES NOT exist... to a it's new location... AND and file that does not exist - to it's new location.

so: myDomain.com/myFolder (which no longer exists) gets redirected to myDomain.com/newLocation/myFolder

and / or

myDomain.com/myFolder.htm (which does NOT exist) gets redirected to myDomain.com/newlocation/myFolder

this is close...

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^myFolder http://myDomain.com/newLocation/myFolder

But I don't necessarily want to TYPE every questionable folder name, I'd prefer to have the 'newLocation" directory checked before the request fails...on any request, not just things i explicitly name

PART 2 Can someone explain the symbols used in the htaccess - or point me to a list... example:

RewriteCond %{REQUEST_URI} ^/$ Rewriterule ^(.*)$ %{REQUEST_URI}/

I look at that and I know there are meanings t0 ^/$ etc - smacks of RegEx (not familiar) or this

RewriteCond %{REQUEST_FILENAME} !-f (what's the !-f mean ????) RewriteCond %{REQUEST_FILENAME} !-d (what's the !-d mean ????) RewriteRule (.*) index.php?_var=$1 [L] ( the $1 means ...)

I want to understand the symbols and the syntax...


<h3>For Part 1 here is the rule will need:</h3> Options +FollowSymLinks -MultiViews RewriteEngine on # if requested URI is not a file and not a directory RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # externally redirect to /newLocation/{URI} RewriteRule ^ /newLocation%{REQUEST_URI} [L,R=301] <h3>For answer to part 2 here is the <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond" rel="nofollow">Apache mod_rewrite official documentation</a></h3>