Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite of affiliate links

How to acheive

         

gosman

11:12 am on Dec 18, 2004 (gmt 0)

10+ Year Member



I am completely new to Apache and every article I read assumes some prior knowledge.

I want to change my affiliate links from the following format

affiliatesite.com/index.jsp?pageName=Search&cid=1234&search=widgets

To

mysite.com/search/widgets

I then want to exclude the search directory in the robots.txt file so I am not hit with a duplicate content penalty.

I would really appreciate if somebody could advise me how to do this. Including what files I need to edit and where they need to be placed.

Thank you in advance.

Gosman

gosman

7:03 pm on Dec 18, 2004 (gmt 0)

10+ Year Member



Anybody?

valder

11:03 pm on Dec 18, 2004 (gmt 0)

10+ Year Member



Redirecting to an external site is easy, but it seems like you want to give your users the impression that they're not leaving your site, when actually they are. I'm not sure if this is possible, or if it should be done, even if possible.

If it's just redirection you're looking for, this should do it;

RewriteRule ^search/widgets affiliatesite.com/index.jsp?pageName=Search&cid=1234&search=widgets [L]

Chico_Loco

1:45 pm on Dec 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think it's possible if the 2 domains are not on the same machine.

If they were you could tell mod_rewrite to read the content from another directory, but with the content being on another machine, the browser actually has to connect to the other domain, which means redirect, not internal rewriting...

If your heart is st on doing this though, you'll need to get a script which can connect to the other server and output it on your site.

Neither are very hard to do.

gosman

12:42 pm on Dec 28, 2004 (gmt 0)

10+ Year Member



Hi Guys.

Thank you for the replies. I need to clarify a little bit more. What I am trying to acheive is the following.

mysite.com/product/54321

redirected to

[myaff.com...]

54321 being a product id variable.

I have done some research on mod rewiting and I beleive I have created some code that may work

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^product/(.*)$ [myaff.com...]

What I now need to know is does the code look valid? and if so, where I place this code on my server? The server our site is on is a cobalt raq.

Thank you.

Gosman

topr8

12:57 pm on Dec 28, 2004 (gmt 0)

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



you need to place this in a file called .htaccess put it in the root of your website.

iit will only work with an apache server

topr8

1:00 pm on Dec 28, 2004 (gmt 0)

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



RedirectMatch ^product/([0-9]*)$

gosman

1:11 pm on Dec 28, 2004 (gmt 0)

10+ Year Member



Thank you Topr8

Works great.

One more question. I want the URL in the address bar to remain as mysite.com/product/54321
not
myaff.com/index.jsp?pageName=Avail&cid=12345&ID=54321

How can I acheive this?

Regards

Graham

topr8

2:20 pm on Dec 28, 2004 (gmt 0)

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



can't be done that i know of (not if you don't control the domain)

gosman

2:35 pm on Dec 28, 2004 (gmt 0)

10+ Year Member



Thank you topr8.

I am right in saying if I now exclude the products directory in my robots.txt file non of these links will be followed?

Regards

Gosman

topr8

5:12 pm on Dec 28, 2004 (gmt 0)

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



yes indeed (theoretically anyway!)

billegal

6:15 pm on Jan 5, 2005 (gmt 0)

10+ Year Member



I'm far from fluent in httpd.conf, but you might be able to keep the url the way you like in the address bar by using "ProxyPass" and "ProxyPassReverse". I've used this for example to change:

[domain...] to localhost:10000

to avoid setting up webmin with SSL. Passwords use SSL across the Internet and pass clearly on the local machine.

The ethics of doing this (passing off someone else's content as your own), however, I leave up to you.

gosman

6:52 pm on Jan 5, 2005 (gmt 0)

10+ Year Member



Just to clarify.

The reason I wanted to do this is not to pass somebody elses content off as my own.

Let me explain.

I am an affiliate for Acme. Acme let me upload a header so the pages I display from them are styled like my site. I have a subdomain acme.mysite.com which actually points to their server. When I do an allinanchor:mysite.com all of the pages acme.mysite.com have been indexed. I think the reason for this is because there is enough of a difference on the page with my header included. To make sure I do not trip any dup content filters I want to exclude all of acme.mysite.com. To acheive this I done a mod rewrite of acme.mysite.com to mysite.com/acme and then excluded /acme in the robots.txt file.

Regards

Gosman