#Turn on URL rewriting
RewriteEngine On 

#Protect hidden files and directories
<FilesMatch "^\.">
Order Allow,Deny
Deny from Allow
</FilesMatch>

#Protect the .htaccess file 
<Files .htaccess>
    Order Allow,Deny
    Deny from all
</Files>

#Redirect requests for non-existent files to index.php 
#RewriteCond %{REQUEST_FILENAME} !-f
#RewrieCond %{REQUEST_FILENAME} !-d
#RewriteRule ./index.php [L]

#Custom Error Pages
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php

#Prevent listing of directories
Options -Indexes

#Disable access to files
<Files ~ "\.(functions|db|config)\.php$">
 Order Allow,Deny
 Deny from all
</Files>

#To hide php extension at the end of files
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

#Try to see if this work to hide link
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]

