Project

General

Profile

Actions

Bug #59037

closed

Set of TYPO3_CONTEXT in .htaccess throws internal server error

Added by Armin Vieweg over 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2014-05-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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.

Actions #1

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

Actions #2

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

Actions #3

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]

Actions #4

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

Actions #5

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

Actions #6

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?

Actions #7

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

Actions #8

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

Actions #9

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

Actions #10

Updated by Armin Vieweg over 10 years ago

Okay, I stop trying^^
Thanks for help :)

Actions #11

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

Actions #12

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

Actions #13

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...

Actions #14

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

Actions #15

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.

Actions #16

Updated by Armin Vieweg over 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #17

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF