#59037Set of TYPO3_CONTEXT in .htaccess throws internal server error
Description
We had a weird behavior of htaccess, caused by default _.htaccess of TYPO3 on Apache servers.
When you call: http://domain.com/fileadmin/second/third
You get an internal server error if the file/dir is not existing.
When you call: http://domain.com/fileadmin/second
You get a 404 error, as expected.
The reason is the combination of:
# Rules to set ApplicationContext based on hostname
#RewriteCond %{HTTP_HOST} ^dev\.example\.com$
#RewriteRule (.*) $1 [E=TYPO3_CONTEXT:Development]
#RewriteCond %{HTTP_HOST} ^staging\.example\.com$
#RewriteRule (.*) $1 [E=TYPO3_CONTEXT:Production/Staging]
#RewriteCond %{HTTP_HOST} ^www\.example\.com$
#RewriteRule (.*) $1 [E=TYPO3_CONTEXT:Production]
RewriteRule ^(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
—-
We also figured out a simple fix, just replace
#RewriteRule (.*) $1 [E=TYPO3_CONTEXT:Development]
#RewriteRule (.*) - [E=TYPO3_CONTEXT:Development]