Rewrite index.shtml working but other pages giving 404. I'm stumped

Hi, I have a test directory on my server where I’d like all my page.shtml files to look like /page/ and all the dir/index.shtml files in subdirectories to look like /dir/ e.g:
(1)
http://www.mysite.com/test/file.shtml
looks like
http://www.mysite.com/test/file/

and (2)
http://www.mysite.com/test/dir/index.shtml
looks like
http://www.mysite.com/test/dir/

plus this should rollout across all subdirectories so that (3)
http://www.mysite.com/test/dir/file.shtml
looks like
http://www.mysite.com/test/dir/file/

I’ve created a .htaccess file in the http://www.mysite.com/test/ directory and I’ve got part of this working (2) so that all index.shtml files are renamed using

Options +FollowSymlinks

RewriteEngine on
RewriteRule ^(.*/)?index.shtml$ http://www.mysite.com/test/$1/ [R=301,L]

But I can’t seem to get (1) and (3) to work using

RewriteRule ^/?(.+)\\.shtml$ http://www.mysite.com/test/$1/ [R,NC,L]

The urls are working in the address bar i.e. http://www.mysite.com/test/dir/file but I get a 404 error every time.

Can anybody give me some pointers on why this is not working? It’d be much appreciated.

As this looks to be too complicated I think I’ll leave it so that

http://www.mysite.com/test/dir/index.shtml
resolves to
http://www.mysite.com/test/dir/
by using:

RewriteRule ^/?(.+)\\index.shtml$ http://www.mysite.com/test/$1 [L,R=301]

And forget the other stuff. I nearly solved it but the whole site uses relative links which will break all the css and images.

Just to add this here for other users who come across this:

Here’s a fix for this issue, supplied by my friend Steve Esson of iqode.com

Options +FollowSymlinks

RewriteEngine On

# This bit removes the '.shtml' from web pages
RewriteCond   %{DOCUMENT_ROOT}%{REQUEST_URI}/index.shtml -f
RewriteRule   ^/(.*)/([^/]+)?$  /$1/$2.shtml [PT]
RewriteCond   %{DOCUMENT_ROOT}%{REQUEST_URI}/index.shtml -f
RewriteRule   ^/([^/]+)?$  /$1.shtml [PT]