I want to be able to redirect url such as subdomain.domain.com/426/long-tail-kw.html
to new domain and url such as differentdomain.com/goodname.php?id=long-tail-kw
Also, the number in the url 426
will change often, it could also be 1
or whatever number up to 500
How can I do this in .htaccess file?
Also, the redirect must work with this code that sends the people who come from bing ONLY to the new url. If a person just enters the url then he will not be redirected but when he comes from bing or from whatever specified referrer then he will be redirected.
Thus far I have this code that I used for my old site that had cat-x
in the url but I don't know how to change the code to work with only a number in the url instead of cat-x
RewriteEngine On
RewriteCond %{HTTP_REFERER} (bing)
RewriteCond %{HTTP_HOST} ^(?:www\.)?server10\.olddomain\.com$ [NC]
RewriteRule ^cat-\d+/(.+?)\.html$ http://newdomain.com/go.php?id=$1 [L,QSA,R=302]