Project

General

Profile

Bug #19565 » typo3-rewrite-staticfilecache.conf

Administrator Admin, 2009-01-15 10:31

 
<IfModule mod_rewrite.c>
RewriteEngine on

# Do not rewrite for static resources
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -l
RewriteRule .* - [PT]


#------------------------------------------------------------------------------
# beginning of static file cache ruleset

# Don't pull *.xml, *.css etc. from the cache
RewriteCond %{REQUEST_FILENAME} !^.*\.xml$
RewriteCond %{REQUEST_FILENAME} !^.*\.css$

# Check for Ctrl Shift reload
RewriteCond %{HTTP:Pragma} !no-cache
RewriteCond %{HTTP:Cache-Control} !no-cache

# Don't cache HTTPS traffic by default. You may choose to comment out this
# option if your site runs fully on https. If your site runs mixed, you will
# not want https traffic to be cached in the same typo3temp folder where it can
# be requested over http.
# Enable this if you use a mixed setup.
RewriteCond %{HTTPS} off

# NO backend user is logged in. Please note that the be_typo_user expires at the
# end of the browser session. So, although you have already logged out of the
# backend, you will still have to either restart your browser or remove the
# cookie manually for this rule to work.
RewriteCond %{HTTP_COOKIE} !be_typo_user [NC]

# NO frontend user is logged in. Logged in frontend users may see different
# information than anonymous users. But the anonymous version is cached. So
# don't show the anonymous version to logged in frontend users.
RewriteCond %{HTTP_COOKIE} !nc_staticfilecache [NC]

# We only redirect GET requests
RewriteCond %{REQUEST_METHOD} GET

# We only redirect URI's without query strings
RewriteCond %{QUERY_STRING} ^$

# We only redirect if a cache file actually exists

# Uncomment the following two lines if you use realurl:
RewriteCond %{DOCUMENT_ROOT}/typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}%{REQUEST_URI}index.html -f
RewriteRule .* /typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}%{REQUEST_URI} [PT]

# Uncomment the following two lines if you use simulateStaticDocuments:
#RewriteCond %{DOCUMENT_ROOT}/typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}%{REQUEST_URI}/index.html -f
#RewriteRule .* typo3temp/tx_ncstaticfilecache/%{HTTP_HOST}%{REQUEST_URI}/index.html [PT]

# end of static file cache ruleset
#------------------------------------------------------------------------------


# Rewrite the rest to index.php
RewriteRule .* /index.php [PT]


# Old style
#RewriteRule ^/(typo3|t3lib|tslib|fileadmin|typo3conf|typo3temp|uploads|showpic\.php|favicon\.ico)/? - [PT]
#RewriteRule ^/typo3$ /typo3/index_re.php [PT]
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
#RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-l
#RewriteRule .* /index.php [PT]

#RewriteLog "/home/httpd/logs/rewrite.log"
#RewriteLogLevel 4
</IfModule>
(2-2/2)