301 Redirect

Ira Vari

Newbie
Joined
Nov 12, 2017
Messages
4
Reaction score
0
I've registered a domain which was a main shop of affiliate program. This domain has backlinks with affiliate IDs like :
domain.com/item100.php?affid=0001&trkid=forum1
domain.com/item111.php?affid=0002&trkid=youtube
domain.com/item1010.php?affid=0101

So, how to make right 301 redirect if my website in HTML now and not php and how to redirect one affiliate's url with multiply tracking IDs to the page I need?
Thank you!
 
Use this at the beginning of the htaccess (before everything else):

RewriteCond %{QUERY_STRING} example=example$
RewriteRule (.*) /? [R=301,L]

So in your case will be:

RewriteCond %{QUERY_STRING} affid=0101$
RewriteRule (.*) /? [R=301,L]

This is 301 to home, if you want to be to another page just use RewriteRule (.*) /whatever-you-want/? [R=301,L]

Play a bit to see how it works best for you.
 
Back
Top