- Custom Visualforce page with an Apex controller to redirect to the correct URL. Take this approach if you can execute client-side conditional logic to redirect the user to where you want. Create an empty Visualforce page and an Apex controller. Pass the required values from the link to the controller. Then execute the logic to determine the URL in the controller method, to perform the redirect.