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.