Actions
Bug #25191
closed.htaccess contains uneccesary rewrite rules
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-02-27
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
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)
Actions