Htaccess File

inky/automeme/master/src/.htaccess

DEFLATE, HTTP_HOST
AddHandler fastcgi-script .py
Options +ExecCGI -Indexes
AddDefaultCharset utf-8
ServerSignature Off
ErrorDocument 404 /404.html

<FilesMatch ".py$">
Order Deny,Allow
Deny from all
</FilesMatch>

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
AddOutputFilterByType application/x-javascript text/javascript application/javascript application/json
</IfModule>

<IfModule mod_alias.c>
Redirect permanent stuff.html http://automeme.net/goodies.html
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# redirect invalid domain names
RewriteCond %{HTTP_HOST} !^(api.|moar.|dev.)?automeme.net$ [NC]
RewriteCond %{HTTP_HOST} !^api.autome.me$ [NC]
RewriteRule ^(.*)$ http://automeme.net/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^api.autome.me$ [NC]
RewriteRule ^(.*)$ http://api.automeme.net/$1 [R=301,L]

# api commands and docs
RewriteCond %{HTTP_HOST} ^api.automeme.net$ [NC]
RewriteRule ^$ api.html [QSA,L]
RewriteCond %{HTTP_HOST} ^api.automeme.net$ [NC]
RewriteRule ^(te?xt|html)$ raw.cgi?format=$1 [QSA,L]
RewriteCond %{HTTP_HOST} ^api.automeme.net$ [NC]
RewriteRule ^(te?xt|html).json$ raw.cgi?format=$1&json=1 [QSA,L]

# canonical home url
RewriteCond %{HTTP_HOST} !^(dev.)?automeme.net$ [NC]

# point the home url to the script
RewriteRule ^$ http://automeme.net/ [R=301,L]

# legacy api
RewriteRule ^moar.(txt|html)$ raw.cgi?format=$1 [QSA,L]
RewriteRule ^moar.(txt|html).json$ raw.cgi?format=$1&json=1 [QSA,L]

# forbid access to python files
RewriteRule .py - [F,L]
</IfModule>
Exit mobile version