# Bitte die Authentication NICHT auskommentieren und ins SVN committen!
# Stattdessen den lokalen Server anpassen oder eine ggf Änderung nicht committen!

# Header set Content-Security-Policy "default-src 'self'; frame-src https://www2.appone.com https://maps.google.com"
# Header set Content-Security-Policy "default-src *; script-src *; frame-src *; child-src *;"

SetEnvIf Host ".\..*" auth=1
#SetEnvIf Host ".*(-test|local\.|home\.|dev\.).*" !auth
SetEnvIf Host ".*(local\.|home\.|dev\.).*" !auth
AuthUserFile  /home/www/p205003/html/.passwd
AuthType        Basic
AuthName  HuberAG
Order Deny,Allow
Satisfy any
Deny from all
require valid-user
Allow from env=auth
		




RewriteEngine On

# RewriteCond %{HTTP_HOST} ^(.*)huber\.no$ [NC]
# RewriteRule ^(.*)$ https://www.hubersverige.se/se/velkommen-til-huber-norge.html [L,R=301]

RewriteCond %{HTTP_HOST} ^(www|home)\.(huber|huber-test|huberfacelift62)\.de$ [NC]
RewriteRule ^(.*)global\/huber-report\/(.*)$ /huber-report/$2 [L,R=301]


# RewriteCond %{QUERY_STRING} ^L=(.*)
# RewriteRule ^(.*)\.html /$1.html?LX=%1 [L,R=301]

# l= taucht irgendow auf
RewriteCond %{QUERY_STRING} ^l=(.*)
RewriteRule ^(.*)\.html /$1.html?L=%1 [L,R=301]

RewriteRule ^(.*)news(.*)\/[0-9]+\.html$ /$1news$2.html  [R,L]
RewriteRule ^(.*)\/news\/news(.*)\/preview\.html$ /$1/news/news$2.html?type=97  [R,L]
RewriteRule ^(.*)\/news\/news(.*)\/print\.html$ /$1/news/news$2.html?type=98  [L]



RewriteRule  ^index.html$ /index.php?L=0 [L]

RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]

RewriteRule ^gewinnspiel$ /de/gewinnspiel [R,L]
RewriteRule  ^upload/(.*) /global/downloadcenter/brochures.html [R,L]







	### BEGIN EXT:tx_staticfilecache #################################################

		# Enable URL rewriting
		RewriteEngine On

		# Redirect from maintenance mode to the live page,
		# because users might not get it
		RewriteCond %{REQUEST_FILENAME} maintenance.html$
		RewriteRule .* / [R=307,L]

		# Do not rewrite any static resources
		RewriteCond %{REQUEST_FILENAME} -f [OR]
	    # RewriteCond %{REQUEST_FILENAME} -d [OR]
		RewriteCond %{REQUEST_FILENAME} -l
		RewriteRule .* - [L]

		#------------------------------------------------------------------------------
		# beginning of static file cache rulesets

		# Set gzip extension into an environment variable if the visitors browser can handle gzipped content.
		RewriteCond %{HTTP:Accept-Encoding} gzip [NC]
		RewriteRule .* - [E=TX_NCSTATICFILECACHE_GZIP:.gz]

		# 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 %{DOCUMENT_ROOT}/typo3temp/tx_staticfilecache/%{HTTP_HOST}/%{REQUEST_URI} !-f
		RewriteRule .* - [E=TX_NCSTATICFILECACHE_FILE:/index.html]

		# Don't cache HTTPS traffic. You may choose to comment out this
		# option if your site runs fully on https. If your site runs mixed, you will
		# not want https traffic to be cached in the same typo3temp folder where it can
		# be requested over http.
		# Enable this if you use a mixed setup.
		#RewriteCond %{HTTPS} off

		# 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 %{DOCUMENT_ROOT}/typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI}%{ENV:TX_NCSTATICFILECACHE_FILE}%{ENV:TX_NCSTATICFILECACHE_GZIP} -f

		# NO frontend user is logged in. Logged in frontend users may see different
		# information than anonymous users. But the anonymous version is cached. So
		# don't show the anonymous version to logged in frontend users.
		RewriteCond %{HTTP_COOKIE} !tx_staticfilecache [NC]

		# We only redirect GET requests
		RewriteCond %{REQUEST_METHOD} GET

		# NO backend user is logged in. Please note that the be_typo_user cookie expires at the
		# end of the browser session. If you have logged out of the TYPO3 backend and are expecting to see cached pages but don't. Please close this browser settion first or remove the cookie manually or use another browser to hit your frontend.
		RewriteCond %{HTTP_COOKIE} !be_typo_user [NC]

		# Check for Ctrl Shift reload
		RewriteCond %{HTTP:Pragma} !no-cache
		RewriteCond %{HTTP:Cache-Control} !no-cache

		# require environment
        RewriteCond %{ENV:StaticCache} true
				
		# We may rewrite the request to the static file.
		RewriteRule .* - [E=TX_NCSTATICFILECACHE_REWRITE:1]

		# normal case
		RewriteCond %{ENV:TX_NCSTATICFILECACHE_REWRITE} 1
		RewriteCond %{REQUEST_FILENAME} !-d
		RewriteRule .* typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{REQUEST_URI}%{ENV:TX_NCSTATICFILECACHE_FILE}%{ENV:TX_NCSTATICFILECACHE_GZIP} [L]

		# root
		RewriteCond %{ENV:TX_NCSTATICFILECACHE_REWRITE} 1
		RewriteCond %{REQUEST_FILENAME} !-f
	    RewriteRule ^$ typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}/%{ENV:TX_NCSTATICFILECACHE_FILE}%{ENV:TX_NCSTATICFILECACHE_GZIP} [L]



		# Set proper content type and encoding for gzipped html.
		<FilesMatch "\.gz">
			<IfModule mod_headers.c>
				Header set Content-Encoding gzip
			</IfModule>
		</FilesMatch>

		# Set proper content type gzipped html
		<FilesMatch "\.html\.gz">
			ForceType text/html
		</FilesMatch>
		# Set proper content type gzipped xml and rss feeds
		<FilesMatch "\.(xml|rss)\.gz">
			ForceType text/xml
		</FilesMatch>


		# end of static file cache ruleset
		#------------------------------------------------------------------------------

	### END EXT:tx_staticfilecache ####################################################
   
   
   
	
	
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php

RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F] 

# pdfs -> downloadhandler
	RewriteRule ^fileadmin/customers/(.*)\.pdf$ \/download\.php\?file=fileadmin/customers/$1\&check=1 [L]
        
# im TYPO3 ordner des Liveservers ist ein .htaccess abzulegen das ein zus�tzliches Passwort zum Abrufen des Backend abfragt. ggf. dort auch auf bestimmte IP.s einschr�nken. Es muss ja nicht jeder probieren k�nnen.
        
  # Send expiry headers for files that do not change often
  # http://httpd.apache.org/docs/2.0/mod/mod_expires.html
  <IfModule mod_expires.c>
    ExpiresActive on
    ExpiresDefault "access plus 2 days"
    ExpiresByType image/gif "access plus 2 days"
    ExpiresByType image/png "access plus 2 days"
   # ExpiresByType text/css "access plus 2 days"
   # ExpiresByType application/x-javascript "access plus 2 days"
   # ExpiresByType text/javascript "access plus 2 days"
    ExpiresByType image/jpeg "access plus 2 days"
  </IfModule>

  # Enable compression (reduce traffic by 70%)
  # http://httpd.apache.org/docs/2.0/mod/mod_deflate.html
  <IfModule mod_deflate.c>
    SetOutputFilter DEFLATE

    # Don't compress everything
    SetEnvIfNoCase Request_URI \.(?i:gif|jpe?g|png)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.(?i:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.avi$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.mov$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.mp3$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.mp4$ no-gzip dont-vary
    SetEnvIfNoCase Request_URI \.rm$ no-gzip dont-vary
  </IfModule>

  # Disable Etags
  # http://httpd.apache.org/docs/2.0/mod/core.html#fileetag
  # Only enable this if you understand ETags and are aware that disabling them
  # means that browsers will have no way of knowing if a file on the server has
  # changed. It keeps your files in the browsers cache untill the expiry time
  # (you chose above) has passed.  Turning off ETags may be a bad idea in
  # combination with long expiry times and content that changes often.
 # FileETag none

  # Or better . . . set sensible Etags.
  FileETag MTime Size