[TYPO3] Need help on .htaccess/realURL

Michael Cannon michael at cannonbose.com
Wed Mar 1 02:23:30 CET 2006


Andreas,

Since you have your hijack protection first, you can keep it that way  
as follows. Please note that I added a RewriteBase and typo3  
directory RewriteRule. You can copy and paste the content between  
-----s to .htaccess directly.

-----
# image protection
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://domain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://domain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://subdom1.domain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://subdom1.domain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://subdom2.domain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://subdom2.domain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.subdom1.domain.com/.*$       
[NC]
RewriteCond %{HTTP_REFERER} !^http://www.subdom1.domain.com$      [NC]
RewriteCond %{HTTP_REFERER} !^http://www.subdom2.domain.com/.*$       
[NC]
RewriteCond %{HTTP_REFERER} !^http://www.subdom2.domain.com$      [NC]
RewriteRule .*\.(jpg|gif|bmp)$ http://www.domain.com/gif/stolen.jpeg  
[R,NC]

# You will have to change this path if your TYPO3 installation is  
located
# in a subdirectory of the website root.
# RewriteBase /mytypo3dir/
RewriteBase /

# typo3 rewrites
RewriteRule ^(typo3|typo3temp|typo3conf|t3lib|tslib|fileadmin|uploads| 
showpic\.php)/ - [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
-----

If you want to allow some directories, say cgi scripts in an admin  
directory, without Typo3 processing, add the following before the  
Typo3 RewriteConds.

RewriteRule ^admin$ - [L]
RewriteRule ^admin/.*$ - [L]


If you want to only let .html and / requests get passed to Typo3,  
replace the Typo3 [L] line with the following. This is handy when you  
have blah.htm or blah.php files that shouldn't be processed by Typo3  
in your system.

RewriteRule (\.html|/)$ index.php [L]


Lastly, if you want a simple redirect to a particular page on an  
error besides using Typo3's own 404 architecture, add the following  
at the end of .htaccess.

ErrorDocument 404 /


Now it's true that you want to limit .htaccess processing because  
every call to the server flows through it. WordPress does require  
an .htaccess file for simpler URLs. You can have static URLs with  
WordPress without .htaccess through the PATH_INFO technique.

Regarding RealURL for Typo3, it's the most flexible system that I  
know of for a CMS system. Any extension that's not in the default  
RealURL configuration is easily added given that the extension was  
written using Typo3's core API.

You may see my RealURL configuration basis for multiple websites at  
http://cvs.cannonbose.com/cgi-bin/viewcvs.cgi/typo3/cbstarter/scripts/ 
realurl.php?view=markup. Don't forget to add domain records to the  
root of each Typo3 site.

Cheers,

Michael

-----
Michael Cannon
President of Cannonbose, LLC
Tel    : +1 (206) 351-0159         Fax : +1 (802) 609-2776



More information about the TYPO3-english mailing list