Enough fighting with mod_rewrite.

Oct 08, 2009

One of the quirks of the old version of Pivot I used to run was that it generated its RSS and ATOM feeds as static XML files with the names /rss.xml and /atom.xml, respectively. Since upgrading to PivotX, which implements these news feeds in a standard fashion (i.e., with the URLs /rss and /atom) with some URL rewrites, everyone who was using the URLs generated by the old release was left out in the cold. I've been trying to set up mod_rewrite to transparently redirect requests for the old feeds to the new ones with an HTTP 301 but after fighting for months I've finally thrown in the towel.

If I'm reading the mod_rewrite docs and PivotX forums correctly this should be simple enough to do in my ~/public_html/.htaccess file (where PivotX puts known-to-work rewriting magick for normal operation):

RewriteRule ^rss\.xml$ pivotx/render.php?feed=rss [R=301,L]
RewriteRule ^atom\.xml$ pivotx/render.php?feed=atom [R=301,L]

Unfortunately, this results in a 404 error but at least it doesn't seem to break the new feeds. I've been experimenting with some variant regular expressions but none of those seem to work, either. I've even tried the most absolutely simple rewrites I could think of but no soap:

RewriteRule rss.xml /rss
RewriteRule atom.xml /atom

I've gone through all of the Apache logs as well as turned on mod_rewrite debug logging, and that hasn't helped, either.

Does anyone know how to fix this? It's probably something stupidly simple and I'm just overthinking it.