I need to redirect if someone goes to any folder e.g. http://site.com/images/
or http://site.com/images
to http://site.com
.
Unless he goes to file e.g. http://site.com/images/index.php
in this case it does not redirect
如今
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} (.*)$ [NC]
RewriteRule ^(.*)$ http://%1/ [R=301,L]
但如果有人在上,则认为它并不完美。 它不可行。
牢记服务器配置,需要把htaccess放到每一倍。