PHP filename tricks explanation (using " .htaccess " )

in file .htaccess:


        RewriteEngine on
        RewriteCond %{REQUEST_FILENAME}.php -f
        RewriteRule ^ %{REQUEST_FILENAME}.php [NC,L]
    
  1. script
  2. data.json
  3. home.html

all PHP - backed but not noticeable in ways used above... !

see directory content ( directory listing )

with ?show-source

  1. script?show-source
  2. data.json?show-source
  3. home.html?show-source

        [php] if( isset($_REQUEST["show-source"]) ) {
            header('Content-Type: text/plain');
            die( file_get_contents( $_SERVER['SCRIPT_FILENAME'] ) );
        }