File: .htaccess

Recommend this page to a friend!
  Classes of Marco Cesarato  >  PHP API Database  >  .htaccess  >  Download  
File: .htaccess
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP API Database
Provide access to database records via REST API
Author: By
Last change: Changed UrlRewrite system
Date: 1 year ago
Size: 1,495 bytes
 

Contents

Class file image Download
# Database Web API
# @author Marco Cesarato <cesarato.developer@gmail.com>
# @copyright Copyright (c) 2018
# @license http://opensource.org/licenses/gpl-3.0.html GNU Public License
# @link https://github.com/marcocesarato/Database-Web-API

<IfModule mod_rewrite.c>

	RewriteEngine On
    Options +FollowSymlinks
    Options +SymLinksIfOwnerMatch
    Options -MultiViews

	RewriteBase /

	RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
	RewriteRule ^.*$ - [E=CWD:%2]

	# Deny some methods
    RewriteCond %{REQUEST_METHOD} ^(TRACE|OPTIONS)
    RewriteRule .* ? [L,F]

    RewriteRule .*\.(git|svn|hg).* %{ENV:CWD}index.php [L] # Deny access repo folder
    RewriteRule ^(config|composer|docs|.*\.([Hh][Tt][Aa])).* %{ENV:CWD}index.php [L] # Deny access
    RewriteRule ^(vendor|hooks|plugins|logs|screenshot|screenshots|screens|docs|documentation|clients)/((.*)\.php)?$ %{ENV:CWD}index.php [L] # Forbidden

	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule . %{ENV:CWD}index.php [L,QSA]

</IfModule>

# File protection
<Files ~ "^(config|config\.(.*))\.php">
    Order Allow,Deny
    Deny from all
</Files>
<Files ~ "^(composer)\.(.*)">
    Order Allow,Deny
    Deny from all
</Files>
<Files ~ "^.*\.([Hh][Tt][Aa])">
    Order Allow,Deny
    Deny from all
    Satisfy all
</Files>
<Files ~ "\.sqlite$">
	Order Allow,Deny
	Deny from All
</Files>
<FilesMatch "\.(log|md|backup|bak|bk|old|o|zip|tar|gz|rar)$">
    Order Allow,Deny
    Deny from All
</FilesMatch>

For more information send a message to info at phpclasses dot org.