[TYPO3-english] Robots.txt for multiple domains

Tony Lush tlush at advancewm.com
Tue Mar 4 15:15:31 CET 2014


On 3/4/2014 2:26 AM, Gregor Hermens wrote:
> Hi Tony,
>
> Tony Lush wrote:
>
>> In .htaccess I have as the final rewrite rule:
>>
>> # Rewrite URL for robots.txt
>> RewriteRule ^robots\.txt$ robots/%{HTTP_HOST}.txt [L]
>>
>> However, when I go to www.domain1.com/robots.txt I get a page not found
>> 404 error.
>
> the last RewriteRule of the default .htaccess acts as a catch-all. You
> have to place your additional rules before that, i.e.:
>
> <IfModule mod_rewrite.c>
>
>    RewriteEngine On
>
>    RewriteCond %{REQUEST_FILENAME} !-f
>    RewriteCond %{REQUEST_FILENAME} !-d
>    RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
>
>    RewriteRule ^fileadmin/(.*/)?_recycler_/ - [F]
>    RewriteRule ^fileadmin/templates/.*(\.txt|\.ts)$ - [F]
>    RewriteRule ^typo3conf/ext/[^/]+/Resources/Private/ - [F]
>
>    RewriteRule ^(typo3/|t3lib/|fileadmin/|typo3conf/|typo3temp/|uploads/|favicon\.ico) - [L]
>
>    RewriteRule ^typo3$ typo3/index_re.php [L]
>
> ## Your rules here:
>    RewriteRule ^robots\.txt$ robots/%{HTTP_HOST}.txt [L]
>
> ## Final catch-all:
>    RewriteCond %{REQUEST_FILENAME} !-f
>    RewriteCond %{REQUEST_FILENAME} !-d
>    RewriteCond %{REQUEST_FILENAME} !-l
>    RewriteRule .* index.php [L]
>
> </IfModule>
>
> hth
> Gregor
>

Perfect.

Thank you, Gregor.

Kind regards -- Tony


More information about the TYPO3-english mailing list