title: remove index.php url rewriting .htaccess
body: <p>I'd written this code for <code>301 redirect</code></p>
  
  <pre><code>RewriteCond %{THE_REQUEST} ^.*\/index\.php\ HTTP/
  RewriteRule ^(.*)index\.php$ /$1 [R=301,L]
  </code></pre>
  
  <p>It is working well in case if I do visit my site as <code>http://mysite.com/index.php</code>, it redirects me to <code>http://mysite.com</code></p>
  
  <p>But on my <code>localhost</code> if I try to visit <code>index.php</code> as <code>localhost/mysite/index.php</code> it redirects me to <code>localhost</code>.</p>
  
  <p>How could I solve this problem? Is the code written above is correct?</p>