Bug #59037
closedSet of TYPO3_CONTEXT in .htaccess throws internal server error
100%
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]and
RewriteRule ^(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
We also figured out a simple fix, just replace
#RewriteRule (.*) $1 [E=TYPO3_CONTEXT:Development]with
#RewriteRule (.*) - [E=TYPO3_CONTEXT:Development]and repeat it for the other contexts.
Updated by Gerrit Code Review over 10 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30328
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30328
Updated by Martin Kutschker over 10 years ago
See for more infos:
https://issues.apache.org/bugzilla/show_bug.cgi?id=38642
The problem is BTW not the server error, which is the result, but the unexpected side effects of the rule to other rules.
I suggest this fix as it avoids an unneccesary grouping in the regexp:
RewriteRule .? - [E=TYPO3_CONTEXT:Development]
Updated by Gerrit Code Review over 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30328
Updated by Gerrit Code Review over 10 years ago
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31109
Updated by Armin Vieweg over 10 years ago
Ups. I think I did something wrong. Just wanted to create a new patch set, but I've created a new review entry o.0
How do I correct this?
Updated by Gerrit Code Review over 10 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31109
Updated by Gerrit Code Review over 10 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31109
Updated by Gerrit Code Review over 10 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31109
Updated by Armin Vieweg over 10 years ago
Okay, I stop trying^^
Thanks for help :)
Updated by Gerrit Code Review over 10 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30328
Updated by Gerrit Code Review over 10 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30328
Updated by Björn Jacob over 10 years ago
Right now I'm implementing the new TYPO3_CONTEXT within our environment. I've found tihs ticket by accident and think in connection with the comment inside the .htaccess the implementation is a little bit missleading. So what's with this line:
# IMPORTANT: This rule has to be the very first RewriteCond in order to work!
The context implementation is a RewriteCond as well...
Updated by Gerrit Code Review over 10 years ago
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/31115
Updated by Armin Vieweg over 10 years ago
Yes but it is not rewriting anything in the URL. It did before this patch, but also just 1:1.
This notice stands there to avoid problems, when accessing real existing files. Therefore these lines have to be the first (url changing) rules.
Updated by Armin Vieweg over 10 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 5d3608c00f8d73f0b6580808e3845acc9df9b974.