Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7702491
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:14:22+00:00 2026-05-31T23:14:22+00:00

Hi i am trying to redirecting visualforce page to google.com page here is my

  • 0

Hi i am trying to redirecting visualforce page to google.com page
here is my VF code

<apex:page controller="google_redir">
  <!-- Begin Default Content REMOVE THIS -->
  <h1>Congratulations</h1>
  This is your new Page
  <!-- End Default Content REMOVE THIS -->
  <apex:form >
  <apex:commandButton action="{! hello1}"  value="Save New Account Value"/>
  </apex:form>
</apex:page>

and here is my apex controller code

public class google_redir{


public PageReference hello1(){
PageReference reference=new PageReference('http://www.google.com');
reference.setRedirect(true);

return reference;
}
}

page not redirected to google.com it shows a blank page.
please help me in correcting the error where i am wrong why it is not redirecting to google.com page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:14:23+00:00Added an answer on May 31, 2026 at 11:14 pm

    The exact code you posted is working for me. I was redirected to http://www.google.com after clicking the Save New Account Value button. I modified your code slightly after testing, though, for readability:

    Page

    <apex:page controller="google_redir">
        <apex:form >
            <apex:commandButton action="{!hello1}"  value="Save New Account Value"/>
        </apex:form>
    </apex:page>
    

    Controller

    public class google_redir {
        public PageReference hello1() {
            PageReference reference=new PageReference('http://www.google.com');
            reference.setRedirect(true);
            return reference;
        }
    }
    

    Could it be an issue with your browser or your Internet connection? Try redirecting to a different URL like http://www.salesforce.com or using a different Internet browser, just to see if that works.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am just trying to crawl a single page start_urls = ['https://www.mileageplusshopping.com/shopping/b____alpha.htm'] but redirecting
I am trying to use SecuritySwitch (http://code.google.com/p/securityswitch/) on an asp.net website. On secure pages
I have a problem with my server redirecting http://www.mylesgray.com:8080/ -> http://www.mylesgray.com/ . Here are
I'm trying to figure out if redirecting all www.example.com requests to example.com will be
I am trying to display a notice after redirecting to a page but it
I'm trying to use the wordpress plugin Redirection to redirect a url like: http://mysite.com/wp-content/uploads/image.jpg
hi I'm trying to inject script to the page i'm redirecting to. how can
Trying to copy the msdn refernce here doesn't work and gives an error I
I've been trying to modify this method from redirecting and returning the contents of
I'm trying to process a payment for a transaction. Currently I'm redirecting to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.