Hitchwiki/hitchwiki/master/public/.htaccess - Htaccess File

Hitchwiki/hitchwiki/master/public/.htaccess

#
# Hitchwiki
#
# Check sometimes:
# https://www.google.com/webmasters/tools/crawl-errors

#
# Error pages
#
ErrorDocument 404 /errors/404.php
ErrorDocument 401 /errors/401.php
ErrorDocument 403 /errors/403.php

#
# Optimize caching
#
FileETag None
<IfModule mod_expires.c>
  ExpiresDefault "access plus 10 years"
  <FilesMatch ".(ico|cur|pdf|flv|jpe?g|JPG|png|PNG|gif|js|css|swf)$">
    ExpiresActive On
    ExpiresDefault "access plus 1 year"
  </FilesMatch>
</IfModule>

#
# SECURITY
#
#RewriteCond %{QUERY_STRING} ../ [NC,OR]
#RewriteCond %{QUERY_STRING} ^.*.(bash|git|hg|log|svn|swp|cvs) [NC,OR]
#RewriteCond %{QUERY_STRING} etc/passwd [NC,OR]
#RewriteCond %{QUERY_STRING} boot.ini [NC,OR]
#RewriteCond %{QUERY_STRING} ftp:  [NC,OR]
#RewriteCond %{QUERY_STRING} http:  [NC,OR]
#RewriteCond %{QUERY_STRING} https:  [NC,OR]
#RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]
#RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [NC,OR]
#RewriteCond %{QUERY_STRING} base64_encode.*(.*) [NC,OR]
#RewriteCond %{QUERY_STRING} ^.*([|]|(|)|<|>|ê|"|;|?|*|=$).* [NC,OR]
#RewriteCond %{QUERY_STRING} ^.*(&#x22;|&#x27;|&#x3C;|&#x3E;|&#x5C;|&#x7B;|&#x7C;).* [NC,OR]
#RewriteCond %{QUERY_STRING} ^.*(%24&x).* [NC,OR]
#RewriteCond %{QUERY_STRING} ^.*(127.0).* [NC,OR]
#RewriteCond %{QUERY_STRING} ^.*(%0|%A|%B|%C|%D|%E|%F).* [NC,OR]
#RewriteCond %{QUERY_STRING} ^.*(globals|encode|localhost|loopback).* [NC,OR]
#RewriteCond %{QUERY_STRING} ^.*(request|select|concat|insert|union|declare).* [NC]
#RewriteCond %{QUERY_STRING} !^loggedout=true
#RewriteCond %{QUERY_STRING} !^action=rp
#RewriteCond %{HTTP_COOKIE} !^.*wordpress_logged_in_.*$
#RewriteCond %{HTTP_REFERER} !^http://maps.googleapis.com(.*)$
#RewriteRule ^(.*)$ - [F,L]

# No directory listing
#Options -Indexes

# Deny access to .gitignores
<Files ".gitignore">
  Order deny,allow
  Deny from all
</Files>

#
# COMMON REWRITES
#

RewriteEngine On
RewriteBase /
Options +FollowSymLinks

RewriteRule ^robots.txt$ /robots.txt.php

# Ensure working of static assets
#RewriteRule ^/(load.php|wp-content|wp-includes|wp-admin|images|skins|stylesheets|config|forum|community|maps|translate|phrasebook-v2|phrasebook)/ - [L]

# Don't allow access to .php~ files
RewriteRule .php~$ - [F,L]

## Hitchwiki Redirects
#RewriteCond %{HTTP_HOST} !^(www.)?hitchwiki.(com|info|net)$ [NC]
#RewriteRule ^(.*) http://hitchwiki.org/$1 [R=301,NE,L]
#
## Hitchgathering redirects
#RewriteCond %{HTTP_HOST} !^(www.)?hitchgathering.(com|info|net)$ [NC]
#RewriteRule ^(.*) http://hitchgathering.org/$1 [R=301,NE,L]

#
# MEDIAWIKI
#

# Add trailing slash to language codes
#RewriteRule ^(..)$ /$1/ [R=301,L]

# Wiki Main_Page for different languages
#RewriteRule ^(..)/(.*)$ /wiki/$2 [L,QSA]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(..)/images/(..)/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/wiki/thumb.php?f=$3&width=$4 [L,QSA,B]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(..)/images/(..)/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/wiki/thumb.php?f=$3&width=$4&archived=3 [L,QSA,B]

#RewriteCond %{REQUEST_URI} !^/noexist.*
#RewriteCond %{REQUEST_URI} !^/(index|redirect|texvc).php$
#RewriteCond %{REQUEST_URI} !^/errors/(40(1|3|4)|500).php$
#RewriteCond %{REQUEST_URI} !^/(favicon.png|favicon.ico|humans.txt|robots.txt)$
RewriteCond %{REQUEST_URI} ^/(..)/(profileinfo.php|opensearch_desc.php|api.php|load.php|stylesheets|extensions|resources|skins|config)
RewriteRule ^(..)/(.*)$ /wiki/$2 [L,QSA]

RewriteRule ^/?(..)(/.*)?$ %{DOCUMENT_ROOT}/wiki/index.php [L]
RewriteRule ^/?$ %{DOCUMENT_ROOT}/wiki/index.php [L]

# If the requested URL to an image directory contains the download query parameter,
# the Content-Disposition-header must be set to attachment.
# https://www.mediawiki.org/wiki/Extension:MultimediaViewer
# https://gerrit.wikimedia.org/r/#/c/120614/3/puppet/templates/content_disposition_attachment.conf.erb
RewriteCond %{REQUEST_URI} ^/images.*
RewriteCond %{QUERY_STRING} ^download$
RewriteRule .* - [E=DOWNLOAD:yes]
#Header set "Content-Disposition" "attachment" env=DOWNLOAD

#
# File uploads
#
php_value post_max_size 10M
php_value upload_max_filesize 8M

On Github License

Files

Download PDF of Htaccess file
DOCUMENT_ROOT, HTTP_COOKIE, HTTP_HOST, HTTP_REFERER, QUERY_STRING, REQUEST_URI, static

Comments

Apache