Apache URL Redirect?

Matthew Seaman m.seaman at infracaninophile.co.uk
Tue May 4 13:17:07 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/05/2010 21:09:26, Chris Maness wrote:
> I while back, I set up a podcast using wordpress.  I did not use any
> special configuration, I just added the files as media, and the
> podcast software picked up the mp3's.  However, now I would like to
> use a podcast plugin that adds all of the correct itunes tags.
> However, this changes the RSS URL from:
> 
> http://podcast.rccoc.org/?feed=rss2
> 
> to:
> 
> http://podcast.rccoc.org/?feed=podcast
> 
> I have tried playing with some directives like:
> 
> Redirect permanent /one http://example.com/two
> 
> but they did not seem to work.  I need apache to return 301 and the new URL.
> 
> Any Ideas?

You can do this with mod_rewrite.  You'll need to use rewrite
conditions, as usually URL arguments are not considered.  See:
http://httpd.apache.org/docs/2.2/rewrite/ for guidance, but something
like this:

RewriteEngine on
RewriteCond %{QUERY_STRING} feed=rss2
RewriteRule ^$	/?feed=podcast [R=301]

which redirects requests for feed=rss2 to feed=podcast -- I think that's
what you're trying to do, but I could have it backwards, in which case
just swap over the appropriate strings in the obvious way.

Untested, but you should be able to get the idea.

	Cheers,

	Matthew

- -- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
                                                  Kent, CT11 9PW
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.14 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvgHiQACgkQ8Mjk52CukIyXBQCfax2bvVOP0PUE8zE+dW391+qB
I0cAn0LSyaSAFezgO5gGQQKROwDsc3Uy
=iNJR
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list