3 # Example .htaccess file for TYPO3 CMS - for use with Apache Webserver
5 # This file includes settings for the following configuration options:
7 # - Compression via TYPO3
8 # - Settings for mod_rewrite (URL-Rewriting)
12 # If you want to use it, you have to copy it to the root folder of your TYPO3 installation (if its
13 # not there already) and rename it to '.htaccess'. To make .htaccess files work, you might need to
14 # adjust the 'AllowOverride' directive in your Apache configuration file.
16 # IMPORTANT: You may need to change this file depending on your TYPO3 installation!
18 # Lines starting with a # are treated as comment and ignored by the web server.
20 # You should change every occurance of TYPO3root/ to the location where you have your website in.
22 # If you have your website located at http://mysite.com/
23 # then your TYPO3root/ is just empty (remove 'TYPO3root/')
24 # If you have your website located at http://mysite.com/some/path/
25 # then your TYPO3root/ is some/path/ (search and replace)
27 # You can also use this configuration in your httpd.conf, but then you have to modify some lines,
28 # see the comments (search for 'httpd.conf')
30 # Questions about this file go to the matching Install mailing list, see
31 # http://typo3.org/documentation/mailing-lists/
36 ### Begin: Compression via TYPO3 ###
38 # Compressing resource files will save bandwidth and so improve loading speed especially for users
39 # with slower internet connections. TYPO3 can compress the .js and .css files for you.
40 # *) Uncomment the following lines and
41 # *) Set $TYPO3_CONF_VARS['BE']['compressionLevel'] = '9' for the Backend
42 # *) Set $TYPO3_CONF_VARS['FE']['compressionLevel'] = '9' together with the TypoScript properties
43 # config.compressJs and config.compressCss for GZIP compression of Frontend JS and CSS files.
45 #<FilesMatch "\.js\.gzip$">
46 # AddType "text/javascript" .gzip
48 #<FilesMatch "\.css\.gzip$">
49 # AddType "text/css" .gzip
51 #AddEncoding gzip .gzip
53 ### End: Compression via TYPO3 ###
56 ### Begin: Browser caching of ressource files ###
58 # Enable long browser caching for JavaScript and CSS files.
60 # This affects Frontend and Backend and increases performance.
61 # You can also add other file extensions (like gif, png, jpg), if you want them to be longer cached, too.
63 <FilesMatch "\.(js|css)$">
64 <IfModule mod_expires.c>
66 ExpiresDefault "access plus 7 days"
71 ### End: Browser caching of ressource files ###
74 ### Begin: Settings for mod_rewrite ###
76 # You need rewriting, if you use a URL-Rewriting extension (RealURL, CoolUri).
78 <IfModule mod_rewrite.c>
80 # Enable URL rewriting
83 # Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
86 # Rules to set ApplicationContext based on hostname
87 #RewriteCond %{HTTP_HOST} ^dev\.example\.com$
88 #RewriteRule .? - [E=TYPO3_CONTEXT:Development]
89 #RewriteCond %{HTTP_HOST} ^staging\.example\.com$
90 #RewriteRule .? - [E=TYPO3_CONTEXT:Production/Staging]
91 #RewriteCond %{HTTP_HOST} ^www\.example\.com$
92 #RewriteRule .? - [E=TYPO3_CONTEXT:Production]
94 # Rule for versioned static files, configured through:
95 # - $TYPO3_CONF_VARS['BE']['versionNumberInFilename']
96 # - $TYPO3_CONF_VARS['FE']['versionNumberInFilename']
97 # IMPORTANT: This rule has to be the very first RewriteCond in order to work!
98 RewriteCond %{REQUEST_FILENAME} !-f
99 RewriteCond %{REQUEST_FILENAME} !-d
100 RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
102 # Basic security checks
103 # - Restrict access to deleted files in Recycler directories
104 # - Restrict access to TypoScript files in default templates directories
105 # - Restrict access to Private extension directories
106 # For httpd.conf, use these lines instead of the next ones:
107 # RewriteRule ^/TYPO3root/fileadmin/(.*/)?_recycler_/ - [F]
108 # RewriteRule ^/TYPO3root/fileadmin/templates/.*(\.txt|\.ts)$ - [F]
109 # RewriteRule ^/TYPO3root/typo3conf/ext/[^/]+/Resources/Private/ - [F]
110 RewriteRule ^fileadmin/(.*/)?_recycler_/ - [F]
111 RewriteRule ^fileadmin/templates/.*(\.txt|\.ts)$ - [F]
112 RewriteRule ^typo3conf/ext/[^/]+/Resources/Private/ - [F]
114 # Stop rewrite processing, if we are in the typo3/ directory.
115 # For httpd.conf, use this line instead of the next one:
116 # RewriteRule ^/TYPO3root/(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
117 RewriteRule ^(typo3/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
119 # If the file/symlink/directory does not exist => Redirect to index.php.
120 # For httpd.conf, you need to prefix each '%{REQUEST_FILENAME}' with '%{DOCUMENT_ROOT}'.
121 RewriteCond %{REQUEST_FILENAME} !-f
122 RewriteCond %{REQUEST_FILENAME} !-d
123 RewriteCond %{REQUEST_FILENAME} !-l
125 # Main URL rewriting.
126 # For httpd.conf, use this line instead of the next one:
127 # RewriteRule .* /TYPO3root/index.php [L]
128 RewriteRule .* index.php [L]
132 ### End: Settings for mod_rewrite ###
135 ### Begin: PHP optimisation ###
137 # If you do not change the following settings, the default values will be used.
139 # TYPO3 works fine with register_globals turned off.
140 # This is highly recommended, if your web server has it turned on.
141 #php_flag register_globals off
143 ### End: PHP optimisation ###
147 ### Begin: Miscellaneous ###
149 # Make sure that directory listings are disabled.
152 ### End: Miscellaneous ###
155 # Add your own rules here.