<IfModule mod_rewrite.c>

	RewriteEngine On
	# Use options from the htaccess in the main directory of the frontend in order
	# to have versioned static files and TYPO3_CONTEXT working
	RewriteOptions inherit

	# Store the current location in an environment variable CWD to use
	# mod_rewrite in .htaccess files without knowing the RewriteBase
	RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
	RewriteRule ^.*$ - [E=CWD:%2]

	# Block non-existing .map files, which are requested by some browsers.
	# We need to do that this way here, because otherwise the rewrite logic
	# of the parent folder will redirect such a request to the typo3/index.php
	# causing the BE (login) to be returned.
	# This is due to the nature of 'RewriteOptions inherit', which copies the rules
	# virtually into this file (at the end) and then the defined rules, which include
	# 'typo3/' will not match in the context of this file.
	RewriteRule \.map$ - [F]

	# Redirect install tool files
	RewriteRule ^install(\/?.*)$ %{ENV:CWD}sysext/install/Start/Install.php [R=307,L]

	# Redirect old entry points
	RewriteRule ^(ajax|alt_clickmenu|alt_db_navframe|alt_doc|alt_file_navframe|browser|db_new|dummy|init|login_frameset|logout|mod|move_el|show_item|tce_db|tce_file|thumbs)\.php$ %{ENV:CWD}deprecated.php
</IfModule>