I'd like to redirect all top level directories to a file using mod_rewrite.
So the following should redirect there:
- http://example.com/test
- http://example.com/test8/
- http://example.com/test_9231/
The following should NOT redirect there:
- http://example.com/test.php
- http://example.com/test_9231/test/
- http://example.com/test/test.php
- http://example.com/test_9231/test
None of the directories will physically exist. Directory names will only contain these characters: A-Za-z0-9_-
I tried this RewriteRule /(.*) /index.php [L]
but subdirectories are still redirected.
I thought adding a slash after the 2nd parenthesis would do the job, but it just broke the redirecting.