Hello. Help with the .htaccess file

Help in what? I saw an article on the site computerlessons.ru , it does not work for me :(

What i want

There is a url - http://site.com/index.php

And I wanted to show http://site.com/index.html and other php files in the browser as well.

Tell me what to write in the .htaccess file?

    4 answers 4

    Well, or not to bother in the future, you can do for all files at once:

     RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)\.html$ $1.php [QSA,L] 

    or if you want to always redirect requests from .html to .php, you can do without checking for the existence of a file (-f flag):

     RewriteEngine on RewriteRule ^(.*)\.html$ $1.php [QSA,L] 
    • It also does not fury on Denver, it can work on a paid hosting. Thanks to all. - AronTito
     <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^index.php$ index.html </IfModule> 
    • Not found The requested URL /index.html was not found on this server. That's what made it out - AronTito
    • Is mod_rewrite module installed on server? check by executing the phpinfo () function; - Elime
    • It works like. registered - AronTito
    • But in general. Htaccess on the server is allowed? - Elime
    • Yes, although it is Denver. V-5.3.2ru - AronTito

    Here is a good description of the encoding http://help-host.ru/site/htaccess/16-russkaya-kodirovka-cherez-htaccess.html

      Take away :

       RewriteEngine on RewriteBase / RewriteCond %{THE_REQUEST} (.*)\.php RewriteRule ^(.*)\.php $1.html [R=301,L] RewriteCond %{THE_REQUEST} (.*)\.html RewriteRule ^(.*)\.html $1.php [L]