Bug #25191
closed.htaccess contains uneccesary rewrite rules
0%
Description
http://forge.typo3.org/projects/typo3v4-core/repository/entry/trunk/_.htaccess
Rule 1:
- Never rewrite 'static' resources. That would be silly right? If a certain request exists as an actual file on the filesystem: serve the file.
Rule 2
- Rewrite everything else.
Rule 3
- wrap the rewrite stuff with an <ifModule > to avoid 500 errors.
Ship with this .htaccess enabled by default.
-------------------------------------------------------------------------------------------<IfModule mod_rewrite.c>
- Enable URL rewriting
RewriteEngine On
- Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
#RewriteBase /
- Rule for versioned static files, configured through:
- - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
- - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
- IMPORTANT: This rule has to be the very first RewriteCond in order to work!
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
- Do not rewrite static resources
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule .* - [L]
- Rewrite the rest to index.php
RewriteRule .* /index.php [L]
</IfModule>
-------------------------------------------------------------------------------------------
The rewrite rules are there to push out FE content as fast as possible. So TYPO3 backend rewrite rules have no place in the .htaccess (and they don't make sense if you use the newly proposed rules).
The following lines make no sense to me:
- Stop rewrite processing, if we are in the typo3/ directory.
- For httpd.conf, use this line instead of the next one:
- RewriteRule ^/TYPO3root/(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
- Redirect http://example.com/typo3 to http://example.com/typo3/index_re.php and stop the rewrite processing.
- For httpd.conf, use this line instead of the next one:
- RewriteRule ^/TYPO3root/typo3$ /TYPO3root/typo3/index.php [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
- If the file/symlink/directory does not exist => Redirect to index.php.
- For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
(issue imported from #M17783)
Updated by Chris topher over 13 years ago
Hi Michiel,
can you check, if the "/TYPO3root" at the beginning of the 2 rules is correct there?
This would then also solve #16658.
Updated by Sigfried Arnold over 13 years ago
I use that for quite a long time now and it showed no problems
- fix for RTE Magic Image and absRefPrefix (optional)
RewriteRule ^(?:.+)uploads/(.*?)$ /uploads/$1 [R,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule .* - [L]
RewriteRule ^typo3$ typo3/ [L]
RewriteRule .* index.php [L]
Updated by Dmitry Dulepov over 13 years ago
Ship with this .htaccess enabled by default.
We discussed that several times and we decided not to do it. That part is closed for now.
Updated by Markus Klein almost 13 years ago
- Target version deleted (
0)
Hi Michiel,
could you please provide a complete patch for your proposed changes?
Thank you.
Updated by Stefan Galinski over 12 years ago
- Category deleted (
Communication) - Status changed from New to Needs Feedback
Updated by Alexander Opitz over 11 years ago
Hi,
as this issue is very old. Does the problem still exists within newer versions of TYPO3 CMS (4.5 or 6.1)?
Updated by Michiel Roos over 11 years ago
Yes it does still exist: http://forge.typo3.org/projects/typo3v4-core/repository/revisions/master/entry/_.htaccess
Updated by Markus Klein over 11 years ago
@Michiel: As asked one year ago, could you please push a patch with your suggestion and/or upload a modified version of the .htaccess file with your suggestions here?
Updated by Gerrit Code Review over 11 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/22529
Updated by Gerrit Code Review almost 11 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/22529
Updated by Gerrit Code Review almost 11 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/22529
Updated by Gerrit Code Review almost 11 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/22529
Updated by Markus Klein almost 11 years ago
- Status changed from Under Review to Closed
- Is Regression set to No