title: .htaccess redirect rule default index and remove .php
body: <p>Hi am a bit slow when it comes to htaccess and this has been giving me a headache all day. I am not sure what I am doing wrong but all my combos of attempts to fix this go awry.</p>
  
  <p>I want index.php to be set as the default index page for folders and the homepage of the site to redirect to formacompany.com/en I don't want .php on the end of my files.</p>
  
  <p>Here is my code i want www.example.com/ru to display the index.php file in the directory but don't want the url to be www.example.com/ru/index</p>
  
  <pre><code>DirectoryIndex index.php
  ErrorDocument 404 /404.php 
  
  RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^\.]+)$ $1.php [NC,L]
  
  redirect 301 /admin/ http://www.example.com/_admin/index.php
  redirect 301 /payment https://www.example.com/en/secure/ccpayment
  
  redirect 301 http://www.formacompany.com http://www.formacompany.com/en/index
  </code></pre>
  
  <p>when i visit example.com/ru i get this as the url and a page error:</p>
  
  <p><a href="http://www.example.com/ru/index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//" rel="nofollow">http://www.example.com/ru/index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//index//</a></p>