[TYPO3-dev] Apache2 rewrite rule for sitemap.xml doesn't work

Christopher Torgalson bedlamhotel at gmail.com
Tue Aug 17 17:45:21 CEST 2010


Hi,

On Tue, Aug 17, 2010 at 8:38 AM, Thomas "Thasmo" Deinhamer
<thasmo at gmail.com> wrote:
> Hello folks!
>
> The following .htaccess rewrite rule:
>
>   # sitemap.xml
>   RewriteCond %{REQUEST_FILENAME} sitemap\.xml
>   RewriteRule ^sitemap\.xml$    /index.php?eID=dd_googlesitemap [L]
>
> does not work and throws the following error:
>    "The page did not exist or was inaccessible. Reason: File "sitemap.xml"
> was not found (2)!"
>
> If I change it to a redirect:
>
>   # sitemap.xml
>   RewriteCond %{REQUEST_FILENAME} sitemap\.xml
>   RewriteRule ^sitemap\.xml$    /index.php?eID=dd_googlesitemap [R,L]
>
> it's correctly redirected!
>
> So I'm wondering what's actually wrong with the rewrite rule?
> It seems that TYPO3 somehow reads the wrong "REQUEST_URI", or
> Apache2 doesn't internally replace the URI correctly?!
>
> Anybody out there who can help me with this?


I don't know the answer to your specific question, but I can tell you
that, for what you're doing, no RewriteCond is needed at all:

RewriteRule ^sitemap\.xml$    /index.php?eID=dd_googlesitemap [R=301,L]

This rule will work fine. The only change I'd make is to change 'R' to
'R=301' [ and this is not relevant to the question :-) ].

-- 
Christopher Torgalson
http://www.typo3apprentice.com/




More information about the TYPO3-dev mailing list