Remove from the section name /index.php

For example, the page http://site.ru/razdel/index.php

It is required to redirect to http://site.ru/razdel/

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

3 answers 3

Like that

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^/?razdel/?$ /razdel/index.php [L] </IfModule> 

    If the address to which the appeal ends ends at index.php or index.html, then we redirect:

     RewriteEngine On RewriteCond %{REQUEST_URI} ^(.*)/index\.(php|html)$ RewriteRule .* http://site.ru%1/ [R=301,L,QSA] 
       RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php?/$1 [L] 

      Just remember to enable mod_rewrite in PHP