Forum Moderators: phranque

Message Too Old, No Replies

Is a dynamic 302 redirect possible using htaccess?

         

Taffy1957

4:25 pm on Jan 22, 2014 (gmt 0)

10+ Year Member



Hi Guys,
I hope one of you can offer some advice on a problem I can't seem to solve..?

Ok 1st of all I'm pulling in affiliate products to my site using an RSS feed, which works fine apart from the bare affiliate links.

Tried about a dozen different WordPress plugins to try to cloak affiliate links, but none would work as I wanted. So I added some code to the RSS plugin in order to cloak the link by changing my domain with the original domain as follows;

this affiliate link;
http://example.com/item/product?ref=affiliate ID

changed to this;
http://my-domain.com/new/goto/item/product?ref=affiliate ID


Everything works just fine up to this point, the problem comes when trying to set up a 302 / 307 redirect from my-domain.com/new/goto/item/* to example.com/item/*

As I have a large number of these links I have attempted to use a wildcard (rightly or wrongly), as the product would remain the same after redirect & only the domain & directories change. Or at least that was my plan, but try as I may I just cannot get it to redirect at all, even after deactivating all plugins!

I feel I'm missing something really simple here, but just cannot figure it out. My last option now is to try & do this redirect using htaccess, so any advice would be greatly
appreciated.

Taffy1957

not2easy

4:52 pm on Jan 22, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Hi Taffy1957 and welcome to WebmasterWorld forum. We try to encourage people to learn how these things work. If you check other threads asking the same question here you can get some ideas to try with. After you read a bit you may easily find the answer you need - along with other great information. If you run into a problem trying something out, people are here to help.

If you are not experienced in editing your htaccess file, it is easy to paste in things you find online that can mess up the way your site works, that's why it is better to help you educate yourself than to just hand out answers. We can't see what else is in that file and it matters.

If it helps at all, this is a very common type of redirect so you may find literally thousands of solutions right here.

lucy24

10:43 pm on Jan 22, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You can't put "cloaking" and "redirect" into the same sentence. A redirect is, by definition, visible: you're telling the browser-- or, in this case, the googlebot-- to make a new request. A human may or may not notice that their browser's address bar has changed. A robot assuredly will.

If you need a way to serve content from location A while the user thinks they're at location B, that's a redirect. With added proxy business if the two locations have different hostnames.

Taffy1957

11:51 pm on Jan 22, 2014 (gmt 0)

10+ Year Member



@not2easy,
Yes I am aware that this is a very common & simple redirect which is why my initial post was more to do with WHY it is not working..? And not so much of HOW to write the code in htaccess. Sorry if I didn't make that clear enough.

@Lucy24
I did not request a lecture on semantics, but as you've been so kind as to offer one, may I draw your attention to Websters definition of "Redirect" - Verb: direct (something) to a new or different place or purpose.(nothing there about it being visible or otherwise.

As for not using redirect & cloaking in the same sentence.? I suggest before offering any further opinions on this topic, you visit this link "[yoast.com ]" a very well respected website.

Have a nice day ;-)

Taffy1957

phranque

12:05 am on Jan 23, 2014 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, Taffy1957!


if you need some advice on your mod_rewrite directives you should post an exemplified version of the relevant code.

please read this first - IMPORTANT: Please Use Example.com For Domain Names in Posts:
http://www.webmasterworld.com/apache/4452736.htm [webmasterworld.com]

lucy24

1:14 am on Jan 23, 2014 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



may I draw your attention to Websters definition of "Redirect"

Servers don't know from dictionaries. ("Webster's" by itself is technically meaningless: any publisher can put out a dictionary and call it Webster's.) They only know from formal directives. 302 and 307 are both redirects.