title: Click on new button redirect to vf page based on the profile
body: <p>I have a requirement in which if i click on new button of a custom object, it should get redirected to a VF page if this is a support profile. else it should show the standard page. can someone help me with this. 
  Below is the code i have tried.</p>
  
  <pre><code>    &lt;apex:page standardController="customobject__c" extensions="customvfpagecontroller1" action="{!redirect}"&gt;
  
      public PageReference redirect() {
  
      PageReference newPage;
      Id tProfile = [select Id from Profile where Name = 'TSupport' limit 1][0].Id;
      Id profileId=userinfo.getProfileId();
      if(profileId == tProfile)
      { 
          newPage = Page.vfpage1;
          return newPage.setRedirect(true);
      } else {
          //it should redirect to standard new page of the custom object
  
      }
  </code></pre>