# the following will redirect www.mysite.com/foo/bar to show the # output of the script previously accessed at # www.mysite.com/foo/cgi-bin/bar.cgi, assuming that direct access to # www.mysite.com/foo/cgi-bin/bar.cgi functions as desired RewriteEngine On # enables Rewrite RewriteBase /foo/ # tells Rewrite to apply the following to # requests beginning with www.mysite.com/foo/ RewriteCond %{REQUEST_URI} !-d # rule applies if request does # not exist as a directory RewriteCond %{REQUEST_URI} !-f # rule applies if request does # not exist as a file RewriteRule ^(\w+)$ /foo/cgi-bin/$1.cgi [L] # perl-compatible # regex applies to # request string # following RewriteBase