Forum Moderators: phranque

Message Too Old, No Replies

Can't get RewriteRule to work

and yes sorry it's for feedburner

         

runey71

5:10 pm on Apr 21, 2009 (gmt 0)

10+ Year Member



I've been going around in circles for hours trying to get this redirect to work... Nothing I do seems to work... I'm sure I'm doing something stupid and I'm hoping a fresh pair of eyes can see the problem...

RewriteCond %{HTTP_USER_AGENT} !FeedBurner
RewriteCond %{HTTP_USER_AGENT} .
RewriteRule ^rss/podcasts/Women-Talk-Sci-Fi\.xml$ http://feeds2.feedburner.com/WomenTalkSciFi [R,L]

Thanks in advance

[edited by: jdMorgan at 2:20 am (utc) on April 22, 2009]
[edit reason] De-linked [/edit]

g1smd

10:53 pm on Apr 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Is that rule in the .htaccess in the root of the site, or is it in some other folder, or in httpd.conf?

The [R] gives a 302 redirect, not a 301 here. Are you sure that is what you really want?

runey71

12:30 am on Apr 22, 2009 (gmt 0)

10+ Year Member



Firstly thanks for your reply :)

It is in the .htaccess in the root of the site

Feedburner and several other sites I have found recommend using 302 rather than 301... Since I'm a newb when it comes to this I'm just sticking with those recommendations right now... I may be able to stumble my way around HTML, CSS and PHP but all this Apache stuff is new to me...

Thanks again for your help...

g1smd

1:03 am on Apr 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



*** Nothing I do seems to work ***

OK. I give up. What is it supposed to do? What does it actually do? How do those two things differ?

runey71

1:13 am on Apr 22, 2009 (gmt 0)

10+ Year Member



It should redirect http://example.com/rss/podcasts/Women-Talk-Sci-Fi.xml to http://feeds2.feedburner.com/WomenTalkSciFi

It is meant to allow me use feedburner to track stats of my podcast usage whilst maintaining my existing subscribers list...

At the moment even with the RewriteRule in there it is not performing the redirect...

[EDIT] If you try clicking on either of those URLS you'll see the first brings up the raw XML data whilst the second takes you to a browser friendly view of the xml within feedeburner... When the redirect is working the first url should also take you to the browser friendly version of the xml feed...

Help that helps to clarify the issue... Thanks...

[edited by: jdMorgan at 2:21 am (utc) on April 22, 2009]
[edit reason] No URLs, please. Use example.com [/edit]

jdMorgan

2:24 am on Apr 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have other working rules in this .htaccess file?

If not, have you enabled the RewriteEngine (using the RewriteEngine on directive) before trying to use it?

Are there any relevant messages in your server error log file?

Jim

runey71

3:41 am on Apr 22, 2009 (gmt 0)

10+ Year Member



RewriteEngine is on... I have had other RewriteRules work in the past... It is a Joomla installation and the standard SEF rewrites seem to work ok... I've include the whole .htaccess file I hope that is ok...

I'll go check the system logs now and get back to you...
EDIT: Could not see any errors associated with that domain... A few file does not exist errors with another domain on the same server but that is it...

<snip>

[edited by: jdMorgan at 4:18 am (utc) on April 22, 2009]
[edit reason] Do NOT post copyrighted code, please. [/edit]

jdMorgan

4:20 am on Apr 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm sorry, but we cannot allow copyrighted code to be posted here in violation of the law.

Please post only the relevant parts of the code, as that would be "fair use" and legal.

I'd have tried to edit the post into compliance, but I'm almost out of time today. :(

Jim

runey71

4:28 am on Apr 22, 2009 (gmt 0)

10+ Year Member



My apologies... Thought that perhaps something else might of been clashing which is why I posted the whole thing...

As for posting only the relevant parts I guess I have done that in the first post... The rest of the .htaccess file is the standard joomla one with the feedburner redirect right at the bottom...

Sorry for the mistake :(

However I just did add this to try and block direct links to media files on my domain and it seems to work perfectly...

Order deny,allow
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.com/.*$ [NC]
RewriteRule \.(gif¦jpg¦png¦mp3¦mpg¦avi¦mov)$ - [F]

So at least that shows .htaccess is doing something just not the feedburner redirect...

THanks

runey71

7:50 am on Apr 22, 2009 (gmt 0)

10+ Year Member



Well I seem to have it working... One problem I was having was relating to cache... Even though I was clearing cache I was still having problems with the Feedburner feed showing me its 'browserfriendly' feed... Fixed that by adding ?format=html on the end...

Previously I was referring to the firectory that my xml was in... ^rss/podcast\.xml$ would never work... Using ^([^.]+)\.xml$ works a charm though...

Not sure if it the right fix or not... Right now I only have one rss feed on the site... I'm not sure what will happen though when I add more xml files... I think no matter which one is used they will all redirect to feedburner/WomenTalkSciFi... Would that be correct? If so how can I make sure that xml 'x' is redirected to feedburner 'x' etc etc... Hope that makes sense :)

Thanks heaps for all your help so far...

RewriteCond %{HTTP_USER_AGENT} !FeedBurner
RewriteRule ^([^.]+)\.xml$ [feeds2.example.com...] [R=302,L]

g1smd

8:25 pm on Apr 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Something like:

RewriteCond %{HTTP_USER_AGENT} !FeedBurner 
RewriteRule ^[b]([^.]+)[/b]\.xml$ http[i]:[/i]//feeds2.example.com/[b]$1[/b]?format=html [R=302,L]