I would like to ask what is needed for security and in general what is needed for my website is my index.php contact.php contactome.php all such php code to hide .php :

 RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php 

But I want to not only hide here, for example, change www.domain.com/index to www.domain.com/home but my main page file is index.php but I can explain to someone who can what is .htaccess and what can I will be blogging with him!

  • ru.stackoverflow.com/a/664833/207445 See 9 item "At the level. Htaccess". - Vanya Avchyan
  • And .htaccess is the file where the settings for the server are written. These settings can also be set in the server's configuration file, only you need to reload it so that the conditions are valid. And using the .htaccess restart server is not needed. - Vanya Avchyan
  • It is clear why htaccess is needed and how to change www.domain.com/index to www.domain.com/ what? - SportsTubers
  • how to change dom1 to domen2? ru.stackoverflow.com/a/673497/207445 - Vanya Avchyan

2 answers 2

  • site
    • home
      • index.php
    • call
      • index.php
  • admin
  • vendor

    RewriteEngine On

    RewriteCond% {REQUEST_FILENAME}! -F

    RewriteCond% {REQUEST_FILENAME}! -D

    RewriteRule ^ ([^.] +) $ $ 1.php [NC, L]

    The .htaccess file is the file for the configuration of the folder in which it is located. In order to change the standard index.php page to home.php, add a line in the .htaccess DirectoryIndex home.php

     # ЗапускаСм Π΄Π²ΠΈΠΆΠΎΠΊ Π·Π°ΠΌΠ΅Π½Ρ‹ RewriteEngine on # Если Π·Π°ΠΏΡ€Π°ΡˆΠΈΠ²Π°Π΅ΠΌΡ‹ΠΉ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ Π½Π΅ ΠΏΠ°ΠΏΠΊΠ° RewriteCond %{REQUEST_FILENAME} !-d # Ссли Π·Π°ΠΏΡ€Π°ΡˆΠΈΠ²Π°Π΅ΠΌΡ‹ΠΉ ΠΎΠ±ΡŠΠ΅ΠΊΡ‚ с дописанным Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΠ΅ΠΌ php - Ρ„Π°ΠΉΠ» RewriteCond %{REQUEST_FILENAME}\.php -f # Π΄Π΅Π»Π°Π΅ΠΌ Π·Π°ΠΌΠ΅Π½Ρƒ с дописываниСм .php RewriteRule ^(.*)$ $1.php 
    • you misunderstood me here for example there is contact.php I want it to be on url / call for example - SportsTubers
    • Well, yes, I also hide the ending like that. Thanks for this. I have www.domain.com/contact/ contact.php file name. This code only hides .php and I want to not only hide rename contact to call for example - SportsTubers