: Using mod_rewrite to rewrite URLs with question marks in them This is probably a mind-numbingly simple question, but for some reason mod_rewrite always manages to completely befuddle me every time
This is probably a mind-numbingly simple question, but for some reason mod_rewrite always manages to completely befuddle me every time I interact with it.
A long time ago when I set up my blog and podcast, I didn't yet grasp the whole concept of permalinks; and so the RSS feed URL that I submitted to iTunes was of the form:
otakunopodcast.com/?feed=podcast (note the question mark)
Now that I have permalinks set up properly, my RSS feed url is now:
otakunopodcast.com/feed/podcast (note the lack of ugly question marks ;-) )
So I would like to write a mod_rewrite rule to convert from the former to the latter, generating a 301 in the process. However every attempt I have made to do so has either ended up in it not working, or worse, causing a rewrite loop.
Any and all help gratefully appreciated. Thanks!
More posts by @Steve110
1 Comments
Sorted by latest first Latest Oldest Best
RewriteCond %{REQUEST_URI} ^/$
RewriteCond %{QUERY_STRING} ^feed=podcast$
RewriteRule ^(.*)$ /feed/podcast [R=301,L]
This works because everything after the ? is the query string, and this rule takes effect when there is a question mark with feed=podcast after it.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.