2010-12-20 15:41:01 +00:00
|
|
|
# Custom error pages for php scripts only
|
2016-12-14 15:01:51 +01:00
|
|
|
<FilesMatch \.php$>
|
2010-12-20 15:41:01 +00:00
|
|
|
ErrorDocument 400 /error.php?400
|
|
|
|
ErrorDocument 401 /error.php?401
|
|
|
|
ErrorDocument 403 /error.php?403
|
2016-12-14 15:03:33 +01:00
|
|
|
ErrorDocument 404 /error.php?404
|
2010-12-20 15:41:01 +00:00
|
|
|
ErrorDocument 500 /error.php?500
|
|
|
|
</FilesMatch>
|
|
|
|
|
2013-02-05 11:07:57 -08:00
|
|
|
### Performance
|
2016-05-23 07:41:09 +02:00
|
|
|
### AddDefaultCharset utf-8
|
2013-02-05 11:07:57 -08:00
|
|
|
|
|
|
|
### Security
|
|
|
|
ServerSignature Off
|
|
|
|
|
2017-04-28 15:07:36 -07:00
|
|
|
#Header unset Pragma
|
|
|
|
|
2013-01-31 14:31:57 -08:00
|
|
|
# secure htaccess file
|
|
|
|
<Files .htaccess>
|
2013-02-05 11:07:57 -08:00
|
|
|
order allow,deny
|
|
|
|
deny from all
|
2013-01-31 14:31:57 -08:00
|
|
|
</Files>
|
|
|
|
|
|
|
|
# protect e107_config.php
|
|
|
|
<Files e107_config.php>
|
2013-02-05 11:07:57 -08:00
|
|
|
order allow,deny
|
|
|
|
deny from all
|
2013-01-31 14:31:57 -08:00
|
|
|
</Files>
|
|
|
|
|
|
|
|
|
2013-02-05 11:07:57 -08:00
|
|
|
### Block Bad Bots
|
|
|
|
SetEnvIfNoCase ^User-Agent$ .*(craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|collector|grabber|webpictures) HTTP_SAFE_BADBOT
|
|
|
|
SetEnvIfNoCase ^User-Agent$ .*(libwww-perl|aesop_com_spiderman) HTTP_SAFE_BADBOT
|
|
|
|
Deny from env=HTTP_SAFE_BADBOT
|
2013-01-31 14:31:57 -08:00
|
|
|
|
2013-02-05 11:07:57 -08:00
|
|
|
### Disable directory listing
|
2017-09-23 16:22:06 -07:00
|
|
|
Options -Indexes -MultiViews
|
2013-01-31 14:31:57 -08:00
|
|
|
|
2013-02-05 11:07:57 -08:00
|
|
|
### limit file uploads to 10mb
|
|
|
|
### LimitRequestBody 10240000
|
2013-01-31 14:31:57 -08:00
|
|
|
|
2008-12-03 20:57:22 +00:00
|
|
|
<IfModule mod_rewrite.c>
|
2015-03-31 07:25:39 -07:00
|
|
|
|
2015-04-01 02:09:25 -07:00
|
|
|
<IfModule mod_env.c>
|
|
|
|
SetEnv HTTP_MOD_REWRITE On
|
2016-02-07 10:53:15 -08:00
|
|
|
SetEnv HTTP_MOD_REWRITE_MEDIA On
|
2017-04-26 13:58:01 -07:00
|
|
|
SetEnv HTTP_MOD_REWRITE_STATIC On
|
2015-04-01 02:09:25 -07:00
|
|
|
</IfModule>
|
2015-03-31 07:25:39 -07:00
|
|
|
|
2009-09-13 16:37:18 +00:00
|
|
|
### enable rewrites
|
2016-05-23 07:41:09 +02:00
|
|
|
### Options +FollowSymLinks
|
2009-09-13 16:37:18 +00:00
|
|
|
RewriteEngine On
|
2008-12-02 23:44:19 +00:00
|
|
|
|
2013-02-05 11:07:57 -08:00
|
|
|
|
2009-09-14 18:22:16 +00:00
|
|
|
### Set this to your e107 site root, path relative to web root
|
2011-12-10 00:08:51 +00:00
|
|
|
### Uncomment it in case your server isn't able to rewrite proper
|
|
|
|
#RewriteBase /
|
2013-02-05 11:07:57 -08:00
|
|
|
|
|
|
|
### Allow only GET and POST methods
|
|
|
|
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS|HEAD)
|
2016-02-03 18:17:14 -08:00
|
|
|
|
|
|
|
|
2013-02-05 11:07:57 -08:00
|
|
|
RewriteRule .* - [F]
|
2008-12-02 23:44:19 +00:00
|
|
|
|
2016-02-03 18:17:14 -08:00
|
|
|
### Rewrite for Image URLs
|
|
|
|
ReWriteRule ^media\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)?$ thumb.php?src=e_MEDIA_IMAGE/$5&$1w=$2&$3h=$4 [NC,L]
|
2016-02-04 12:42:48 -08:00
|
|
|
ReWriteRule ^media\/avatar\/(a)?([\d]*)x(a)?([\d]*)\/(.*)?$ thumb.php?src=e_AVATAR/$5&$1w=$2&$3h=$4 [NC,L]
|
2016-02-03 18:17:14 -08:00
|
|
|
RewriteRule ^media\/img\/([-A-Za-z0-9+/]*={0,3})\.(jpg|gif|png)?$ thumb.php?id=$1 [NC,L]
|
2016-02-06 19:33:23 -08:00
|
|
|
ReWriteRule ^theme\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)?$ thumb.php?src=e_THEME/$5&$1w=$2&$3h=$4 [NC,L]
|
2016-02-03 18:17:14 -08:00
|
|
|
|
2017-04-26 13:58:01 -07:00
|
|
|
### Rewrite for Static Scripts
|
|
|
|
ReWriteRule ^static\/[0-9]*\/(.*)$ $1 [NC,L]
|
|
|
|
|
2009-09-13 16:37:18 +00:00
|
|
|
### send 404 on missing files in these folders
|
|
|
|
RewriteCond %{REQUEST_URI} !^/(e107_images|e107_files)/
|
|
|
|
|
|
|
|
### don't rewrite for existing files, directories and links
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-f
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-d
|
|
|
|
RewriteCond %{REQUEST_FILENAME} !-l
|
|
|
|
|
2011-11-25 17:58:03 +00:00
|
|
|
### Single entry point ###
|
2011-12-01 22:08:23 +00:00
|
|
|
RewriteRule .* index.php [L]
|
2009-09-13 16:37:18 +00:00
|
|
|
|
2008-12-03 20:57:22 +00:00
|
|
|
</IfModule>
|
2013-05-25 19:17:21 -07:00
|
|
|
|
2016-02-07 10:53:15 -08:00
|
|
|
### Mod_Expires Settings (when available)
|
|
|
|
### May be modified if required
|
|
|
|
<IfModule mod_expires.c>
|
|
|
|
ExpiresActive On
|
|
|
|
ExpiresDefault "access plus 2 hours"
|
2016-11-27 15:04:04 +00:00
|
|
|
ExpiresByType image/x-icon "access plus 1 year"
|
2016-02-07 10:53:15 -08:00
|
|
|
ExpiresByType image/gif "access plus 1 week"
|
|
|
|
ExpiresByType image/png "access plus 1 week"
|
|
|
|
ExpiresByType image/jpg "access plus 1 week"
|
|
|
|
ExpiresByType image/jpeg "access plus 1 week"
|
|
|
|
ExpiresByType text/css "access plus 1 month"
|
|
|
|
ExpiresByType application/javascript "access plus 1 month"
|
|
|
|
ExpiresByType text/javascript "access plus 1 month"
|
|
|
|
ExpiresByType text/x-javascript "access plus 1 month"
|
|
|
|
</IfModule>
|
|
|
|
|
2016-02-07 11:16:00 -08:00
|
|
|
### Gzip Compression Module
|
2016-02-07 10:53:15 -08:00
|
|
|
<ifmodule mod_deflate.c>
|
|
|
|
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/xml text/xml application/rss+xml
|
|
|
|
</ifmodule>
|
|
|
|
|
2017-04-28 15:07:36 -07:00
|
|
|
<FilesMatch "\.(js|css|ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4|eot|otf|ttc|ttf|woff|woff2)$">
|
2017-05-20 05:16:04 +04:00
|
|
|
<IfModule mod_headers.c>
|
|
|
|
Header set Cache-Control "public"
|
|
|
|
Header unset Cookie
|
|
|
|
Header unset Set-Cookie
|
|
|
|
# Header set Access-Control-Allow-Origin "http://mydomain.com"
|
2017-10-23 13:01:19 -07:00
|
|
|
# Header set Access-Control-Allow-Origin "*" # if you're really stuck.
|
2017-05-20 05:16:04 +04:00
|
|
|
</IfModule>
|
2017-04-26 13:58:01 -07:00
|
|
|
</FilesMatch>
|
|
|
|
|
2016-02-07 10:53:15 -08:00
|
|
|
|
2013-05-25 19:17:21 -07:00
|
|
|
### Enable when developing locally.
|
|
|
|
### SetEnv E_DEV true
|