#redirect from website.com to www.website.com
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteEngine On
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^\.]+)$ $1.php [NC,L]


# Rewrite from HTTP to HTTPS 

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

#redirect html page to the root domain
RewriteRule ^index\.php$ / [NC,R,L]


# prevent viewing of .htaccess file
<FilesMatch "^\.htaccess$">
    Order allow,deny
    Deny from all
</FilesMatch>

ErrorDocument 404 /404

