I have a daunting problem with dynamic redirects that I have to do on WordPress website that was before an aspx website.
I am looking for advice for a week now and tried almost everything with different outcomes but none proved successful.
I need to redirect complex URLs such as:
/Products/tabid/174/CategoryID/134/List/0/Level/a/ProductID/6572/Language/en-GB/Default.aspx?SortField=ProductName%2CProductName
to something simple like
http://domain.com/folder/
I've used number of ideas including loads from StackOverflow but none seem to tackle this specific example. Using standard Redirect 301 rule will work for as long as I don't have ? in the link. I understand this is beyond the scope of Redirect 301 and I need to use RewriteRule.
I tried this (got this from the excel spreadsheet for dynamic urls redirection):
RewriteCond %{QUERY_STRING} ^SortField=ProductName%2CProductName$
RewriteRule ^Products/tabid/174/CategoryID/134/List/0/Level/a/ProductID/6572/Language/en-GB/Default\.aspx$ http://domain.com/folder/? [R=301,L]
But still on entering the url it yields 404 page.
Here's my .htaccess:
## 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]
## messing up
RewriteCond %{QUERY_STRING} ^SortField=ProductName%2CProductName$
RewriteRule ^Products/tabid/174/CategoryID/134/List/0/Level/a/ProductID/6572/Language/en-GB/Default\.aspx$ http://domain.com/folder/? [R=301,L]
</IfModule>
Do I place it correctly? Is the code right? I would appreciate any ideas and clues. Thanks a million