I've been working on a 301 redirect for a dynamic URL for the past couple days and have really been struggling.
I am looking to redirect example.com/?feed=podcast
to example.com/feed/podcast
Here is my current .htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^feed$ "http\:\/\/example\.com\/feed\/podcast" [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I am trying to add a redirect for a dynamic URL. I have been able to get this to work:
RewriteCond %{QUERY_STRING} ^pizza$
RewriteRule ^$ http://www.example.com/feed/podcast? [R=301,L]
But I can't get this to work:
RewriteCond %{QUERY_STRING} ^feed=podcast$
RewriteRule ^$ http://www.example.com/feed/podcast? [R=301,L]
It ends up redirecting back to example.com
Any help would be much appreciated!