18 replies
Wondered if anyone could help with this redirect problem:

One of the guys I'm an affiliate for is changing his whole system over from cfm to asp.

My old links look like this:
http://www.domain.com/productname.cfm?aff=myaffid

the new links look like this:
http://www.domain.com/affiliates/productname.asp?affid=myaffid
(where myaffid is different to before)

There are hundreds of different 'productname' pages.

Preferred Option:
Is there anything I can do on my server to redirect outgoing links to the new url ? Maybe htaccess mod rewrite?

Second Option:
Is there anything he can do on his server to redirect my incoming links to the new url, carrying my new affid instead of the old? Possibly send all my traffic to a php script that says if the link is this url, send it to that url.
#problem #redirect
  • Profile picture of the author apoorv.parijat
    The preferred option will work just as well.

    Add these lines to your .htaccess file. >>

    Redirect /productname.cfm?aff=myaffid /affiliates/productname.asp?affid=myaffid

    Let me know if it works.

    Cheers.
    {{ DiscussionBoard.errors[2616611].message }}
  • Profile picture of the author Bluewater
    Thanks for the reply. But no, that didnt work.

    From my very limited knowledge of htaccess wouldn't that be the command for moving received traffic from one url to another?

    I need it so that when a visitor clicks on the old link on my site, it takes them to the new url.

    The reason I'm trying to avoid changing everything by hand or find and replace is that there hundreds of old links with tons of different 'productnames' buried amongst 300K posts on my forum.
    Signature

    {{ DiscussionBoard.errors[2616692].message }}
  • Profile picture of the author mojojuju
    Originally Posted by Bluewater View Post


    Second Option:
    Is there anything he can do on his server to redirect my incoming links to the new url, carrying my new affid instead of the old? Possibly send all my traffic to a php script that says if the link is this url, send it to that url.
    He needs to do this for his own sake and not just yours. This can be done with .htaccess and mod_rewrite. Doing this on your own server will do not a thing for you. If he doesn't get these affiliate urls rewritten on his server, he's going to see a lot of 404's in his logs.

    If you can't get the guy to fix things on his end (and I can't see why he wouldn't want to fix it), you could use an automated method to do a find/replace of all pages on your site to fix the urls.
    Signature

    :)

    {{ DiscussionBoard.errors[2616820].message }}
  • Profile picture of the author Bluewater
    Thanks mojo,
    yeah he is going to redirect his urls, prob via a 301 redirect in the htaccess since this will be a permanent url change.

    Problem is the redirect at his end will drop my aff id and not carry my new one - so he'll still get the traffic and sales but I wont get the credit. To be fair, that's something he wants to avoid too.

    Yeah looks like a find and replace in order, really not looking forward to doing that with my forum database though, messing with big databases scares me silly.
    Signature

    {{ DiscussionBoard.errors[2616896].message }}
    • Profile picture of the author mojojuju
      Originally Posted by Bluewater View Post

      Problem is the redirect at his end will drop my aff id and not carry my new one -

      Why? If your aff id is the same, the new urls can be written to include your aff id. mod_rewrite is can do this easily. Or, did you say you have a different aff id. I'm confused. Even so, through htaccess - on his end - your old affid can be replaced by your new affid (if you have a new one that is).
      Signature

      :)

      {{ DiscussionBoard.errors[2616920].message }}
  • Profile picture of the author Bluewater
    Yeah my aff id will be different, previously 4 letters soon to be 4 numbers. All the products will have different urls too, and there are maybe 100 products in all.

    Old url:
    domian.com/productname.cfm?aff=myaffid

    New Url:
    domain.com/affiliates/differentproductname.asp?affid=differentmyaffid
    Signature

    {{ DiscussionBoard.errors[2616965].message }}
    • Profile picture of the author SteveJohnson
      Originally Posted by Bluewater View Post

      Yeah my aff id will be different, previously 4 letters soon to be 4 numbers. All the products will have different urls too, and there are maybe 100 products in all.

      Old url:
      domian.com/productname.cfm?aff=myaffid

      New Url:
      domain.com/affiliates/differentproductname.asp?affid=differentmyaffid
      Well, now you just got complicated.

      You can still use what I gave you in the previous post, but you'll have to do one for each product!

      Or, you could have someone write a PHP script that would redirect to the new link based on a matrix of old/new values.

      Whatever way, you have some work ahead of you
      Signature

      The 2nd Amendment, 1789 - The Original Homeland Security.

      Gun control means never having to say, "I missed you."

      {{ DiscussionBoard.errors[2617006].message }}
  • Profile picture of the author SteveJohnson
    Dudes - there is no .htaccess or mod_rewrite on Windows servers!!

    Sorry for shouting, but geez - if you're going to offer solutions, offer ones that work.

    The new server needs to have the ISAPI rewrite module for Windows servers installed, then he can use a version of rewrite rules that basically look like Apache rewrite rules.

    To the OPer: you've learned a valuable lesson about affiliate links - run them through your own link cloaker first! It'll save you from having to change all of your aff links when something like this happens.

    In the meantime, doing a f/r on your db records is the only solution and you'll have to do it anyway, regardless.

    P.S. You can rename those aff links to point at your own domain, then use a RedirectMatch directive in your .htaccess file (assuming you're on a LAMP server) to redirect to the new affiliate URL.

    You'd just add an extra folder name when you're replacing links in your db file: replace 'olddomain.com/' with 'yourdomain.com/go/'.

    Then match to the new URL scheme. Something like this (not tested of course, so don't use this out of the box. Google for RedirectMatch):

    Code:
    RedirectMatch /go/(.*)$ http://newdomain.com/affiliates/$1
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[2616999].message }}
    • Profile picture of the author mojojuju
      Originally Posted by SteveJohnson View Post

      Dudes - there is no .htaccess or mod_rewrite on Windows servers!!
      Oh yeah. Wasn't even thinking about the file extensions.
      Signature

      :)

      {{ DiscussionBoard.errors[2617019].message }}
    • Profile picture of the author cyphix
      Originally Posted by SteveJohnson View Post

      Dudes - there is no .htaccess or mod_rewrite on Windows servers!!

      Sorry for shouting, but geez - if you're going to offer solutions, offer ones that work.

      The new server needs to have the ISAPI rewrite module for Windows servers installed, then he can use a version of rewrite rules that basically look like Apache rewrite rules.

      To the OPer: you've learned a valuable lesson about affiliate links - run them through your own link cloaker first! It'll save you from having to change all of your aff links when something like this happens.

      In the meantime, doing a f/r on your db records is the only solution and you'll have to do it anyway, regardless.

      P.S. You can rename those aff links to point at your own domain, then use a RedirectMatch directive in your .htaccess file (assuming you're on a LAMP server) to redirect to the new affiliate URL.

      You'd just add an extra folder name when you're replacing links in your db file: replace 'olddomain.com/' with 'yourdomain.com/go/'.

      Then match to the new URL scheme. Something like this (not tested of course, so don't use this out of the box. Google for RedirectMatch):

      Code:
      RedirectMatch /go/(.*)$ http://newdomain.com/affiliates/$1
      Ummmmm...... not sure if that is 100% right as I use mod_rewrite on my local windows machine just fine.

      I'm running Apache though & not IIS.
      {{ DiscussionBoard.errors[2671276].message }}
      • Profile picture of the author SteveJohnson
        Originally Posted by cyphix View Post

        Ummmmm...... not sure if that is 100% right as I use mod_rewrite on my local windows machine just fine.

        I'm running Apache though & not IIS.
        Yes, it's 100% right. I didn't say "windows machine". I said a windows SERVER. The OP shows the new destination URLs as having .asp extension - which is a windows server, not Apache. The mod_rewrite module is for Apache, not Windows Server or IIS.
        Signature

        The 2nd Amendment, 1789 - The Original Homeland Security.

        Gun control means never having to say, "I missed you."

        {{ DiscussionBoard.errors[2674114].message }}
  • Profile picture of the author SteveJohnson
    By the way, if you want to do a simple find/replace on your database table, you can use the following:
    Code:
    UPDATE `table_name` SET `field_name` = REPLACE(field_name,'http://oldomain.com/','http://newdomain.com/');
    BACK UP YOUR DATABASE FIRST!!!
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[2617063].message }}
  • Profile picture of the author Bluewater
    Thanks Steve.

    Yeah I've been using (php) redirects for affiliate links for sometime now, thing is some of these particular links have been around for 8 years. Back then I barely knew how to write the code for the link itself let alone how to redirect it.

    As for the find and replace in the database, I have a great host and they've said if I send them a list of old and new urls they'll do it for me
    Signature

    {{ DiscussionBoard.errors[2623454].message }}
  • Profile picture of the author roydsilva2
    If you are facing redirection problems, then make sure you crosscheck your website links. At times, broken or faulty links can lead to this problem.
    {{ DiscussionBoard.errors[2670574].message }}
  • Profile picture of the author SmartWeb
    Originally Posted by Bluewater View Post

    Wondered if anyone could help with this redirect problem:

    One of the guys I'm an affiliate for is changing his whole system over from cfm to asp.

    My old links look like this:
    http://www.domain.com/productname.cfm?aff=myaffid

    the new links look like this:
    http://www.domain.com/affiliates/productname.asp?affid=myaffid
    (where myaffid is different to before)

    There are hundreds of different 'productname' pages.

    Preferred Option:
    Is there anything I can do on my server to redirect outgoing links to the new url ? Maybe htaccess mod rewrite?

    Second Option:
    Is there anything he can do on his server to redirect my incoming links to the new url, carrying my new affid instead of the old? Possibly send all my traffic to a php script that says if the link is this url, send it to that url.
    Coming to .htaccess file, only he can add some code (i would show what), to his .htaccess to redirect your old urls to new one.
    You can't modify your .htaccess to bring solution for this issue.
    If the links had your domain in start, you could have modified your .htaccess file.

    Now, coming to what he should do in his .htaccess file, below is the code.
    I have implemented these kind of htaccess for lots of redirection, i hope it would work for you.


    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)\.cfm?aff=([^/]*) http://www.domain.com/affiliates/$1.asp?aff=$2 [NC,L]

    he need to add these 3 lines to his htaccess file.
    let me know if it helps to you
    {{ DiscussionBoard.errors[2670836].message }}
  • Profile picture of the author ryanhall789
    If all that haven't worked for you, there is nothing much you can do about it. Communicate with your affiliate provider regarding this issue.
    {{ DiscussionBoard.errors[2673888].message }}
  • Profile picture of the author buncaila
    use Redirect 301 in htaccess file. this works good,
    {{ DiscussionBoard.errors[2682220].message }}
  • Profile picture of the author robertransey
    If you are presenting redirection problems, then make sure you check your site links. At times, burst or incorrect links can extend to this problem.
    {{ DiscussionBoard.errors[2760560].message }}

Trending Topics