Update .htaccess files
This commit is contained in:
+20
-149
@@ -1,31 +1,3 @@
|
||||
SetEnv TYPO3_CONTEXT "Development"
|
||||
|
||||
#####
|
||||
#
|
||||
# Example .htaccess file for TYPO3 CMS - for use with Apache Webserver
|
||||
#
|
||||
# This file includes settings for the following configuration options:
|
||||
#
|
||||
# - Compression
|
||||
# - Caching
|
||||
# - MIME types
|
||||
# - Cross Origin requests
|
||||
# - Rewriting and Access
|
||||
# - Miscellaneous
|
||||
# - PHP optimisation
|
||||
#
|
||||
# If you want to use it, you have to copy it to the root folder of your TYPO3 installation (if its
|
||||
# not there already) and rename it to '.htaccess'. To make .htaccess files work, you might need to
|
||||
# adjust the 'AllowOverride' directive in your Apache configuration file.
|
||||
#
|
||||
# IMPORTANT: You may need to change this file depending on your TYPO3 installation!
|
||||
# Consider adding this file's content to your webserver's configuration directly for speed improvement
|
||||
#
|
||||
# Lots of the options are taken from https://github.com/h5bp/html5-boilerplate/blob/master/dist/.htaccess
|
||||
#
|
||||
####
|
||||
|
||||
|
||||
### Begin: Compression ###
|
||||
|
||||
# Compressing resource files will save bandwidth and so improve loading speed especially for users
|
||||
@@ -35,13 +7,13 @@ SetEnv TYPO3_CONTEXT "Development"
|
||||
# *) Set $GLOBALS['TYPO3_CONF_VARS']['FE']['compressionLevel'] = 9 together with the TypoScript properties
|
||||
# config.compressJs and config.compressCss for GZIP compression of Frontend JS and CSS files.
|
||||
|
||||
#<FilesMatch "\.js\.gzip$">
|
||||
# AddType "text/javascript" .gzip
|
||||
#</FilesMatch>
|
||||
#<FilesMatch "\.css\.gzip$">
|
||||
# AddType "text/css" .gzip
|
||||
#</FilesMatch>
|
||||
#AddEncoding gzip .gzip
|
||||
<FilesMatch "\.js\.gzip$">
|
||||
AddType "text/javascript" .gzip
|
||||
</FilesMatch>
|
||||
<FilesMatch "\.css\.gzip$">
|
||||
AddType "text/css" .gzip
|
||||
</FilesMatch>
|
||||
AddEncoding gzip .gzip
|
||||
|
||||
<IfModule mod_deflate.c>
|
||||
# Force compression for mangled `Accept-Encoding` request headers
|
||||
@@ -97,7 +69,7 @@ SetEnv TYPO3_CONTEXT "Development"
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_mime.c>
|
||||
AddEncoding gzip svgz
|
||||
AddEncoding gzip svgz
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
|
||||
@@ -264,6 +236,7 @@ AddDefaultCharset utf-8
|
||||
# Enable URL rewriting
|
||||
RewriteEngine On
|
||||
|
||||
# Force SSL for all domains
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
|
||||
|
||||
@@ -291,7 +264,7 @@ AddDefaultCharset utf-8
|
||||
# Access block for folders
|
||||
RewriteRule _(?:recycler|temp)_/ - [F]
|
||||
RewriteRule fileadmin/templates/.*\.(?:txt|ts)$ - [F]
|
||||
RewriteRule ^(?:vendor|typo3_src|typo3temp/logs) - [F]
|
||||
RewriteRule ^(?:vendor|typo3_src|typo3temp/var) - [F]
|
||||
RewriteRule (?:typo3conf/ext|typo3/sysext|typo3/ext)/[^/]+/(?:Configuration|Resources/Private|Tests?|Documentation|docs?)/ - [F]
|
||||
|
||||
# Block access to all hidden files and directories with the exception of
|
||||
@@ -305,109 +278,6 @@ AddDefaultCharset utf-8
|
||||
# NOTE: Add your additional local storages here
|
||||
RewriteRule ^(?:typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
|
||||
|
||||
### Begin: Static File Cache (preparation) ####
|
||||
|
||||
# Document root configuration
|
||||
RewriteRule .* - [E=SFC_ROOT:%{DOCUMENT_ROOT}]
|
||||
# RewriteRule .* - [E=SFC_ROOT:%{DOCUMENT_ROOT}/t3site] # Example if your installation is installed in a directory
|
||||
|
||||
# Cleanup URI
|
||||
RewriteCond %{REQUEST_URI} ^.*$
|
||||
RewriteRule .* - [E=SFC_URI:/%{REQUEST_URI}]
|
||||
RewriteCond %{REQUEST_URI} ^/.*$
|
||||
RewriteRule .* - [E=SFC_URI:%{REQUEST_URI}]
|
||||
RewriteCond %{REQUEST_URI} ^/?$
|
||||
RewriteRule .* - [E=SFC_URI:/]
|
||||
|
||||
# Cleanup HOST
|
||||
RewriteCond %{HTTP_HOST} ^([^:]+)(:[0-9]+)?$
|
||||
RewriteRule .* - [E=SFC_HOST:%1]
|
||||
|
||||
# Get scheme
|
||||
RewriteCond %{SERVER_PORT} ^443$ [OR]
|
||||
RewriteCond %{HTTP:X-Forwarded-Proto} https
|
||||
RewriteRule .* - [E=SFC_PROTOCOL:https]
|
||||
RewriteCond %{SERVER_PORT} !^443$
|
||||
RewriteCond %{HTTP:X-Forwarded-Proto} !https
|
||||
RewriteRule .* - [E=SFC_PROTOCOL:http]
|
||||
|
||||
# Get port (not used at the moment)
|
||||
RewriteRule .* - [E=SFC_PORT:80]
|
||||
RewriteCond %{SERVER_PORT} ^[0-9]*$ [OR]
|
||||
RewriteRule .* - [E=SFC_PORT:%{SERVER_PORT}]
|
||||
|
||||
# Check if the requested file exists in the cache, otherwise default to index.html that
|
||||
# set in an environment variable that is used later on
|
||||
RewriteCond %{ENV:SFC_ROOT}/typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}/%{ENV:SFC_HOST}%{ENV:SFC_URI} !-f
|
||||
RewriteRule .* - [E=SFC_FILE:index.html]
|
||||
|
||||
# Note: https://github.com/lochmueller/staticfilecache/pull/90 (Please check the realurl configuration related to "appendMissingSlash". Perhaps you need an additional "/" in the rule above)
|
||||
# RewriteRule .* - [E=SFC_FILE:/index.html]
|
||||
|
||||
# Set gzip extension into an environment variable if the visitors browser can handle gzipped content and the gz-file exists
|
||||
RewriteRule .* - [E=SFC_GZIP:]
|
||||
RewriteCond %{HTTP:Accept-Encoding} gzip [NC]
|
||||
RewriteRule .* - [E=SFC_GZIP:.gz]
|
||||
RewriteCond %{ENV:SFC_ROOT}/typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}/%{ENV:SFC_HOST}%{ENV:SFC_URI}%{ENV:SFC_FILE}%{ENV:SFC_GZIP} !-f
|
||||
RewriteRule .* - [E=SFC_GZIP:]
|
||||
|
||||
# Note: We cannot check realurl "appendMissingSlash" or other BE related settings here - in front of the delivery.
|
||||
# Perhaps you have to check the "SFC_FILE" value and set it to your related configution e.g. "index.html" (without leading slash).
|
||||
# More information at: https://github.com/lochmueller/staticfilecache/pull/28
|
||||
|
||||
### Begin: Static File Cache (main) ####
|
||||
|
||||
# We only redirect URI's without query strings
|
||||
RewriteCond %{QUERY_STRING} ^$
|
||||
|
||||
# It only makes sense to do the other checks if a static file actually exists.
|
||||
RewriteCond %{ENV:SFC_ROOT}/typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}/%{ENV:SFC_HOST}%{ENV:SFC_URI}%{ENV:SFC_FILE}%{ENV:SFC_GZIP} -f
|
||||
|
||||
# NO frontend or backend user is logged in. Logged in users may see different
|
||||
# information than anonymous users. But the anonymous version is cached. So
|
||||
# don't show the anonymous version to logged in users.
|
||||
RewriteCond %{HTTP_COOKIE} !staticfilecache [NC]
|
||||
|
||||
# Uncomment the following line if you use MnoGoSearch
|
||||
#RewriteCond %{HTTP:X-TYPO3-mnogosearch} ^$
|
||||
|
||||
# We only redirect GET requests
|
||||
RewriteCond %{REQUEST_METHOD} GET
|
||||
|
||||
# Rewrite the request to the static file.
|
||||
RewriteRule .* %{ENV:SFC_ROOT}/typo3temp/tx_staticfilecache/%{ENV:SFC_PROTOCOL}/%{ENV:SFC_HOST}%{ENV:SFC_URI}%{ENV:SFC_FILE}%{ENV:SFC_GZIP} [L]
|
||||
|
||||
# Do not allow direct call the cache entries
|
||||
RewriteCond %{ENV:SFC_URI} ^/typo3temp/tx_staticfilecache/.*
|
||||
RewriteCond %{ENV:REDIRECT_STATUS} ^$
|
||||
RewriteRule .* - [F,L]
|
||||
|
||||
### Begin: Static File Cache (options) ####
|
||||
|
||||
# Set proper content type and encoding for gzipped html.
|
||||
<FilesMatch "\.gz">
|
||||
<IfModule mod_headers.c>
|
||||
Header set Content-Encoding gzip
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
|
||||
# if there are same problems with ForceType, please try the AddType alternative
|
||||
# Set proper content type gzipped html
|
||||
<FilesMatch "\.html\.gz">
|
||||
ForceType text/html
|
||||
# AddType "text/html" .gz
|
||||
</FilesMatch>
|
||||
<FilesMatch "\.xml\.gz">
|
||||
ForceType text/xml
|
||||
# AddType "text/xml" .gz
|
||||
</FilesMatch>
|
||||
<FilesMatch "\.rss\.gz">
|
||||
ForceType text/xml
|
||||
# AddType "text/xml" .gz
|
||||
</FilesMatch>
|
||||
|
||||
### End: Static File Cache ###
|
||||
|
||||
# If the file/symlink/directory does not exist => Redirect to index.php.
|
||||
# For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
@@ -418,19 +288,20 @@ AddDefaultCharset utf-8
|
||||
</IfModule>
|
||||
|
||||
# Access block for files
|
||||
<FilesMatch "(?i:^\.|^#.*#|^(?:ChangeLog|ToDo|Readme|License)(?:\.md|\.txt)?|^composer\.(?:json|lock)|^ext_conf_template\.txt|^ext_typoscript_constants\.txt|^ext_typoscript_setup\.txt|flexform[^.]*\.xml|locallang[^.]*\.(?:xml|xlf)|\.(?:bak|co?nf|cfg|ya?ml|ts|dist|fla|in[ci]|log|sh|sql(?:\..*)?|sw[op]|git.*)|.*(?:~|rc))$">
|
||||
# Apache < 2.3
|
||||
<IfModule !mod_authz_core.c>
|
||||
# Apache < 2.3
|
||||
<IfModule !mod_authz_core.c>
|
||||
<FilesMatch "(?i:^\.|^#.*#|^(?:ChangeLog|ToDo|Readme|License)(?:\.md|\.txt)?|^composer\.(?:json|lock)|^ext_conf_template\.txt|^ext_typoscript_constants\.txt|^ext_typoscript_setup\.txt|flexform[^.]*\.xml|locallang[^.]*\.(?:xml|xlf)|\.(?:bak|co?nf|cfg|ya?ml|ts|typoscript|tsconfig|dist|fla|in[ci]|log|sh|sql(?:\..*)?|sqlite(?:\..*)?|sw[op]|git.*)|.*(?:~|rc))$">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
Satisfy All
|
||||
</IfModule>
|
||||
|
||||
# Apache ≥ 2.3
|
||||
<IfModule mod_authz_core.c>
|
||||
</FilesMatch>
|
||||
</IfModule>
|
||||
# Apache ≥ 2.3
|
||||
<IfModule mod_authz_core.c>
|
||||
<If "%{REQUEST_URI} =~ m#(?i:/\.|/\x23.*\x23|/(?:ChangeLog|ToDo|Readme|License)(?:\.md|\.txt)?|/composer\.(?:json|lock)|/ext_conf_template\.txt|/ext_typoscript_constants\.txt|/ext_typoscript_setup\.txt|flexform[^.]*\.xml|locallang[^.]*\.(?:xml|xlf)|\.(?:bak|co?nf|cfg|ya?ml|ts|typoscript|tsconfig|dist|fla|in[ci]|log|sh|sql(?:\..*)?|sqlite(?:\..*)?|sw[op]|git.*)|.*(?:~|rc))$#">
|
||||
Require all denied
|
||||
</IfModule>
|
||||
</FilesMatch>
|
||||
</If>
|
||||
</IfModule>
|
||||
|
||||
# Block access to vcs directories
|
||||
<IfModule mod_alias.c>
|
||||
|
||||
Reference in New Issue
Block a user