Forum Moderators: phranque
mod_rewrite is "just out of the box" here.
I think my issue won't be too difficult to solve for those of you familiar with mod_rewrite, but I'm not getting anywhere with it.
At one time, I was serving 3 rss feeds from my site, but now, only 1.
Google FeedFetcher continues to bug my server looking for the missing feeds.
I've used Google's Webmaster Tools to request that those feeds be removed from the site index, and it shows they have been removed, but still my httpd-access.log is filled with:
72.14.199.106 - - [19/Apr/2009:05:41:22 -0500] "GET /blog.rss HTTP/1.1" 404 206 "-" "Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; 1 subscribers; feed-id=6739455439618173225)
So, as a challenge to myself,what if I used mod_rewrite to send a "Gone" to those requests?
In httpd.conf, I currently have:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ="blog.rss" [OR]
RewriteCond %{REQUEST_URI} ="adesnse.rss"
RewriteRule \.rss [G]
RewriteLog /var/log/httpd-rewrite.log
RewriteLogLevel 3
</IfModule>
bit it's not working, I get a 404 when I try it.
the rewrite log says:
192.168.254.3 - - [19/Apr/2009:06:25:27 --0500] [curly/sid#80a7f10][rid#8179058/initial] (2) init rewrite engine with requested uri
/blog.rss
192.168.254.3 - - [19/Apr/2009:06:25:27 --0500] [curly/sid#80a7f10][rid#8179058/initial] (3) applying pattern '\.rss' to uri '/blog.
rss'
192.168.254.3 - - [19/Apr/2009:06:25:27 --0500] [curly/sid#80a7f10][rid#8179058/initial] (1) pass through /blog.rss
I assume pass through means, the pattern didn't match, or I told mod_rewrite to skip that rule...?
How should this be configured?
(I wouldn't mind verbosity from anyone who can help) :-)
TIA,
Charles
FreeBSD 6.4-STABLE, Apache 2.2.11
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/blog\.rss$ [OR]
RewriteCond %{REQUEST_URI} ^/adsense\.rss$
RewriteRule .* - [G]
RewriteLog /var/log/httpd-rewrite.log
RewriteLogLevel 3
</IfModule>
I didn't have my regexp correct, nor did I have my rule correct. Guess that sorta crashes and burns the whole thing, eh? ;-)
I's still be very interested to hear any comments on anything I mentioned upthread.
Thanks to this thread:
[webmasterworld.com...]
I'd look at the rule being:
RewriteRule ^(blogĻadsense)\.rss$ - [G] If you do, it would be something like:
RewriteCond %{REQUEST_URI} ^/(blog¦adsense)\.rss$
The only time you need to check "almost the same thing" in a RewriteCond and RewriteRule is when you are checking to see if the current Req_Rec (the URL-path examined by RewriteRule) has been previously rewritten.
In these cases, it is required to check %{THE_REQUEST} to be sure that the current URL-path matched by the RewriteRule was directly-requested by the client, and did not occur as the result of a previously-executed internal rewrite (in the context of this current HTTP transaction).
Note that there's another way to detect previously-executed internal rewrites: examining %{ENV:REDIRECT_STATUS} to see if it's blank or not.
However, in the case at hand, neither test is needed since the result of a match is a 410-Gone response.
Jim