Forum Moderators: phranque

Message Too Old, No Replies

Confusing Rewrite Problem

Rewrite stopped with Apache upgrade

         

spander

11:45 pm on Apr 18, 2006 (gmt 0)

10+ Year Member



I recently migrated to a new server running RedHat Linux. The old one was running Apache/1.3.27 The new one is running Apache/2.0.52

This Rewrite code always worked without a flaw.

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^/feed_(.*)_(.*)\.shtml$ http://rss.example.com/rss.cgi?action=view_one_feed&fid=$1&catID=$2

It still redirects, but now rather than showing the static url in the browser, it shows the changed dynamic one.

What am I missing? Any help would be appreciated.

[edited by: jdMorgan at 12:38 am (utc) on April 19, 2006]
[edit reason] de-linked, examplified. [/edit]

jdMorgan

12:41 am on Apr 19, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your code should indeed show the dynamic URL in the browser address bar, because the syntax indicates an external redirect -- as specifically noted in the mod_rewrite documentation.

If you're looking for an internal rewrite, remove the "http://rss.example.com" part of the substitution URL.

If your feed URLs are always of the form "/feed_<something>_<something>.shtml", where <something> never contains an additional underscore, then the following code should be noticably faster to process:


RewriteRule ^/feed_([^_]+)_([^.]+)\.shtml$ /rss.cgi?action=view_one_feed&fid=$1&catID=$2 [L]

Jim

spander

1:01 am on Apr 19, 2006 (gmt 0)

10+ Year Member



Wow! I spent hours and hours on this thing, and you solve my problem in a few minutes. I did a lot of searching on G and found several people with the same problem, but no solutions.

It's funny though. That syntax worked great on the old Apache.

Much appreciated.