Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将其设为默认值:
从:
mydomain.com/folder/folder/
至:
mydomain.com/folder/folder/index.php
反正要做.htaccess什么?
.htaccess
这会将所有两级文件夹从/f1/f2/to重定向/f1/f2/index.php并显示在地址栏中。它不重定向/f1/f2或/f1/script.php(没有斜杠)
/f1/f2/
/f1/f2/index.php
/f1/f2
/f1/script.php
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !index\.php [NC] RewriteCond %{REQUEST_URI} ^/(\w+)/(\w+)/$ RewriteRule .* %1/%2/index.php [R,L]