Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using year/month/post-name permalinks, and also using the download-monitor plugin to handle file downloads. I added rewrite rules to the top of the .htaccess file following the instructions at perishable press.

I just did this same thing at another blog and it worked just fine. The only differences are that blog did not use the download-monitor and the install was in the root of the domain, instead of a /blog/ sub-directory.

If I comment out this line:

RewriteCond %{REQUEST_URI} ^/?feed.* [NC]

It works. I am simply curious as to why would this line be in the instructions if it doesn't work? Does it have something to do with the sub-directory?

.htaccess:

# temp redirect all wordpress feeds to feedburner
# from http://perishablepress.com/press/2008/03/25/redirect-wordpress-feeds-to-feedburner-via-htaccess-redux/
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /blog/
RewriteCond %{REQUEST_URI} ^/?feed.* [NC]
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC] 
RewriteRule ^feed/?.*$ http://feeds.feedburner.com/mysite [L,NC,R=302]
</IfModule>

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /blog/
RewriteRule ^download/([^/]+)$ http://www.mysite.com/blog/wp-content/plugins/download-monitor/download.php?id=$1 [L]
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

# END WordPress
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted
+25

Try this. This format works for me. You don't have to keep repeating IfModule, RewriteEngine, RewriteBase.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{HTTP_USER_AGENT} !^.*(FeedBurner|FeedValidator) [NC] 
RewriteRule ^feed/?.*$ http://feeds.feedburner.com/mysite [L,NC,R=302]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]

RewriteRule ^download/([^/]+)$ http://www.mysite.com/blog/wp-content/plugins/download-monitor/download.php?id=$1 [L]
</IfModule>
# END WordPress

Here is a nice how-to for htaccess: http://codeigniter.com/wiki/mod_rewrite/

And if you continue to have trouble, perhaps consider using a plugin: http://wordpress.org/extend/plugins/tentbloggers-feedburner-rss-redirect-plugin/screenshots/

share|improve this answer
    
So, are you saying that the line: RewriteCond %{REQUEST_URI} ^/?feed.* [NC] is not required? It seems to work when I remove that line, but didn't understand why that line would be in the instructions. –  jjeaton Jul 31 '11 at 16:49
    
That RewriteCond is still required, if you see it on my code, it's still there. You just don't have to keep repeating ifModule, RewriteEngine, and RewriteBase. Compare the code above with the one you originally posted. –  Sean Lee Aug 1 '11 at 7:26
    
Ok, I used your version, and I can't get it to work, as in now none of the feed links redirect to FeedBurner. I will rephrase my question above. –  jjeaton Aug 2 '11 at 5:02
1  
ReWriteCond../?feed is a directive that defines a rule condition where current state of URI matches that of /?feed. In your original post, you claimed problem on first line of rewritebase. Therefore I left this alone. This line is not necessary. Since you noted that you learned your code from perishablepress, you must have read their comment to remove this line if your server doesn't redirect properly. –  Sean Lee Aug 2 '11 at 5:11
    
duh, I wasn't redirecting the comments feed, so I think I glossed over that part. Thanks! Also, the only reason everything was separated out in my .htaccess is due to allowing WordPress up add in its own rules and the download monitor, and I just copied in the feedburner code. Yours is definitely cleaner. –  jjeaton Aug 2 '11 at 22:48
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.