index.htmlredirect,同时使用Apache mod_rewrite维护静态index.html文件
这是我的目标: /any-directory-or-subdirectory应显示/any-directory-or-subdirectory/index.html的内容 /any-directory-or-subdirectory/应该redirect到/any-directory-or-subdirectory (没有结尾的斜杠) /any-directory-or-subdirectory/index.html应该redirect到/any-directory-or-subdirectory /any-directory-or-subdirectory/something.htm我应该显示自己的内容。 我有这个工作在一个特定的目录完美: DirectorySlash Off RewriteEngine on RewriteRule ^specific-dir$ /specific-dir/index.html [L,E=LOOP:1] RewriteCond %{ENV:REDIRECT_LOOP} !1 RewriteRule ^specific-dir/$ /specific-dir [R=301,L] RewriteCond %{ENV:REDIRECT_LOOP} !1 RewriteRule ^specific-dir/index.html$ /specific-dir [R=301,L] 我需要这个工作在所有的子目录,而不是一个特定的,也为同样的function在网站的根源。 我已经尝试了很多东西来适应这个代码的工作,但迄今为止还没有任何运气。