我写了这段代码301 redirect
RewriteCond %{THE_REQUEST} ^.*\/index\.php\ HTTP/
RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
如果我确实访问我的网站http://mysite.com/index.php,它运行良好,它会将我重定向到http://mysite.com
但是,localhost如果我尝试访问index.php,因为localhost/mysite/index.php它会将我重定向到localhost.
我该如何解决这个问题?上面写的代码是否正确?