+ Start a Discussion

Search Engine Optimization and Redirects in Salesforce

I am working on what is essentially an affiliate marketing application where a user on a third party site (the referrer) clicks a link to our site and our site redirects the user to another third party site (the recipient).  I would like to do this in Salesforce however, The Salesforce Sites URL Redirect rules are too limited for my use case.


In my use case on the referrer's website the user clicks on a link to www.myVFpage.com/LinkForwarding?lnk=1234. The Visualforce page looks up the specified link number on the Salesforce Custom Object - Link Manager and gets the recipients URL and then conducts the redirect to the recipients website.


The code is as follows:

Visualforce Page LinkForwarding

<apex:page controller="ControllerLinkForwarding" action="{!init}">



public class ControllerLinkForwarding {  
  public pagereference init(){
   Link_Manager__c l = [select id, URL__c,Name from Link_Manager__c
       where Name =   
         :ApexPages.currentPage().getParameters().get('link') limit 1];
    PageReference newPage = new pageReference (l.URL__c);
    return newPage;



This approach is bad for search engine optimization.  I am looking for an approach that does a 301 redirect. What other ways can I attempt to do this. Any suggestions would be most appreciated. Thanks!