Project

General

Profile

Actions

Bug #25191

closed

.htaccess contains uneccesary rewrite rules

Added by Michiel Roos over 13 years ago. Updated almost 11 years ago.

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>
  1. Enable URL rewriting
    RewriteEngine On
  1. Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
    #RewriteBase /
  1. Rule for versioned static files, configured through:
  2. - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
  3. - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
  4. 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]
  1. Do not rewrite static resources
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -l
    RewriteRule .* - [L]
  1. 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:


  1. Stop rewrite processing, if we are in the typo3/ directory.
  2. For httpd.conf, use this line instead of the next one:
  3. RewriteRule ^/TYPO3root/(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
    RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
  1. Redirect http://example.com/typo3 to http://example.com/typo3/index_re.php and stop the rewrite processing.
  2. For httpd.conf, use this line instead of the next one:
  3. RewriteRule ^/TYPO3root/typo3$ /TYPO3root/typo3/index.php [L]
    RewriteRule ^typo3$ typo3/index_re.php [L]
  1. If the file/symlink/directory does not exist => Redirect to index.php.
  2. 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)

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #16658: Wrong information in _.htaccess for httpd.conf configurationClosed2006-10-19

Actions
Actions

Also available in: Atom PDF