Forum Moderators: phranque

Message Too Old, No Replies

Redirect new RSS feed to old feed URL?

         

datac0de

8:17 pm on Feb 27, 2007 (gmt 0)

10+ Year Member



I have a site that has been using http://www.example.com/domain.rss as the main RSS feed. I'm moving the site to WordPress so now the URL is http://www.example.com/feed/rss2/. I did a simple htaccess redirect...
Redirect temp /example.rss http://www.example.com/feed/rss2/
While this works fine to simply redirect the feed to the new URL, Is there anyway to redirect the new feed and retain the URL as the old feed (http://www.example.com/domain.rss)?

[edited by: jdMorgan at 12:09 am (utc) on April 17, 2007]
[edit reason] Example.com [/edit]

jdMorgan

10:07 pm on Feb 27, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes. Use mod_rewrite to internally rewrite the URL, instead of externally redirecting it.

Jim

datac0de

4:44 pm on Apr 14, 2007 (gmt 0)

10+ Year Member




System: The following message was spliced on to this thread from: http://www.webmasterworld.com/apache/3311168.htm [webmasterworld.com] by encyclo - 3:47 pm on April 14, 2007 <small>(utc -4)</small>


I started a previous thread a couple months ago (http://www.webmasterworld.com/apache/3265816.htm) about redirecting a new WordPress driven RSS feed to an old legacy feed URL. I'm finally back to try to figure it out now, but the old post is closed :( - hopefully it's OK to start a new thread.

I have done some searching on this site and have been trying to internally rewrite the URL. This is the code that I came up with that does not work...


RewriteEngine on
RewriteBase /
RewriteRule ^domain\.rss$ http://www.example.com.com/feed/rss2/

When I attempt to browse to http://www.example.com/domain.rss I get a "Error 404 - Not Found" from WordPress. I think I'm going to try to do an internal rewrite without WordPress in the equation and see if I can get a static XML page to work.

[edited by: jdMorgan at 12:09 am (utc) on April 17, 2007]
[edit reason] Example.com [/edit]

datac0de

9:50 pm on Apr 14, 2007 (gmt 0)

10+ Year Member



I moved all the WordPress files to a temporary directory outside of the servers root directory and created a static XML document at http://www.example.com/feed/rss2.rss Next I created an .htaccess with the following code...

RewriteEngine on
RewriteBase /
RewriteRule ^domain\.rss$ http://www.example.com/feed/rss2.rss

Now this one did work! I even was able to add the URL http://www.example.com/domain.rss into my news reader (NetNewsWire) and it shows the URL as /domain.rss but has the content from /feed/rss2.rss

So I think I'm on the right track. Back to trying to get it working with WordPress.

[edited by: jdMorgan at 12:10 am (utc) on April 17, 2007]
[edit reason] Example.com [/edit]

datac0de

9:36 pm on Apr 16, 2007 (gmt 0)

10+ Year Member



With a little looking I found the original RSS feed path in WordPress...
http://www.example.com/wp-rss2.php

I have WordPress setup with default Permalinks, so it is not doing any kind of rewriting. I added the code to my htaccess...


RewriteEngine on
RewriteBase /
RewriteRule ^domain\.rss$ http://www.example.com/wp-rss2.php

http://www.example.com/domain.rss fails with a 404 :(

Does anyone have a suggestion on why this is not working? Is it because it's hitting a php script instead of a static page?

[edited by: jdMorgan at 12:11 am (utc) on April 17, 2007]
[edit reason] Example.com [/edit]

jdMorgan

10:16 pm on Apr 16, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are the feed files physically located in a directory at or below the document root in which this .htaccess code is located?

Jim

datac0de

10:56 pm on Apr 16, 2007 (gmt 0)

10+ Year Member



The static XML file that works with the rewrite is located at /httpdocs/feed/rss2.rss and the htaccess file is at /httpdocs/.htaccess
The dynamic rss file that is generated by WordPress is at /httpdocs/wp-rss2.php

jdMorgan

12:02 am on Apr 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The critical element is that an .htaccess file can only affect files in the same directory, or in a subdirectory of the .htaccess file's directory.

Unfortunately, I'm stumped. The only other things I can think of are that WP has installed an Alias or rewrite directive in your httpd.conf that is 'diverting' control away from your .htaccess file, or that some other capable-of-interfering module or function such as MultiViews or AcceptPathInfo is interfering...

[added] It *is* important that the rewrite works when the target is not an existing php file as you discovered, but I am still scratching my head trying to figure out why and exactly what that means. I can't identify the fault mechanism, but something is tickling in the back of my mind... [/added]

Jim

[edited by: jdMorgan at 12:05 am (utc) on April 17, 2007]

datac0de

2:58 am on Apr 17, 2007 (gmt 0)

10+ Year Member



I'm pretty sure WordPress didn't modify httpd.conf. I'm running of a shared server and don't have direct access to it.

I did another little test... Instead of pointing to the WordPress php file that is generating the RSS feed, I pointed to another dynamic WordPress php file - /index.php


RewriteEngine on
RewriteBase /
RewriteRule ^domain\.rss$ http://www.domainname.com/index.php

Now when I visit [domainname.com...] I get the content that is at [domainname.com...]

I don't know if this helps narrow it down any further.