Htaccess File

benargo/atwd/master/.htaccess

DEFLATE, GET, no-gzip, POST, REQUEST_FILENAME, REQUEST_METHOD
Options -Indexes

# Error Logs
php_flag log_errors on
php_flag display_errors 1
php_value error_log logs/error.log

<FilesMatch "/crimes/">
  ErrorDocument 404 /api/catch_all.php
</FilesMatch>

# Compression
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0[678] no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  RewriteRule ^$ crimes/doc/index.html [R]

  # PHP Source Files
  RewriteRule ^(.*).phps$ https://github.com/benargo/atwd/blob/master/$1.php [L,R=301]

  # 1. Data Conversion and Schema
  RewriteRule ^data(/)?$ data/upload [R]

  RewriteCond %{REQUEST_METHOD} GET
  RewriteRule ^data/upload$ data/upload.get.php [L]

  RewriteCond %{REQUEST_METHOD} POST
  RewriteRule ^data/upload$ data/upload.post.php [L]

  # 2. RESTful Service
  RewriteCond %{REQUEST_METHOD} GET
  RewriteRule ^crimes/([-d]+)/(xml|json)$ api/getAll.php?year=$1&response=$2 [L,QSA]

  RewriteCond %{REQUEST_METHOD} GET
  RewriteRule ^crimes/([-d]+)/(w+)/(xml|json)$ api/get.php?year=$1&region=$2&response=$3 [L,QSA]

  RewriteCond %{REQUEST_METHOD} GET
  RewriteRule ^crimes/([-d]+)/put/(w+):(d+)/(xml|json)$ api/put.php?year=$1&region=$2&value=$3&response=$4 [L,QSA]

  RewriteCond %{REQUEST_METHOD} GET
  RewriteRule ^crimes/([-d]+)/post/(w+)/(w+)/([w-:]+)/(xml|json)$ api/post.php?year=$1&region=$2&area=$3&params=$4&response=$5 [L,QSA]

  RewriteCond %{REQUEST_METHOD} GET
  RewriteRule ^crimes/([-d]+)/delete/(w+)/(xml|json)$ api/delete.php?year=$1&area=$2&response=$3 [L,QSA]

  # 3. Reset Script
  RewriteRule ^crimes/reset$ api/reset.php [L]

  # 4. Documentation
  RewriteRule ^crimes/doc(/)?(index.html)?$ docs/readme.html [L]

  # 5. Test Script
  RewriteRule ^test/([a-z0-9-]+)$ test/index.php?username=$1 [L]

  # 5. Catch all
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^crimes/.* api/catch_all.php [L,QSA]
</IfModule>
Exit mobile version