• Amey Priolkar
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 3
    Replies

Hi all,

 

I am newbie to visual force.

I have created a visual force site, and provided a URL rewriter class to it.

My class implements Site.UrlRewriter interface. i have implemented mapRequestUrl() method and the other method is returning null.

I want to redirect the visual force page to site.com page.

i have written a very simplest mapping code as given below.

 

 

 

global class redirectingClass implements Site.UrlRewriter {
  String DIRECTORY = '/LoadOffersPage/';
  String internalDomain='https://sitepreview.ap1.force.com';
  global PageReference mapRequestUrl(PageReference externalUrl) {
       PageReference pageref= new PageReference(internalDomain + '/CLP/?category=a0290000006KSYAAA4');
               pageref.setRedirect(true);
               return pageref;
     }
  global List<PageReference> generateUrlFor(List<PageReference> myForcedotcomUrls) {
      return null;
  }
}

 

my site url is this.

http://abhishek-gupta-developer-edition.ap1.force.com/

 

is it possible to rewrite url in this way. Or where i am going wrong.

Also i read something about about "enabling url rewriting in the site" but didnt get anything about how???

Is it simply like associating the class as URL rewriter class for  the site.

 

thanks and regards

abhishek

I have a global with sharing controller which I'm using in VF page which uses JS Remoting. When I call ApexPages.Currentpage() or ApexPages.Currentpage().getParameters(), I'm getting null exception, anybody facing this issue ? is it a limitaion ?

 

Thanks

Ram

 

  • April 26, 2012
  • Like
  • 0
I'm trying to see if the URL ReWriter functionality can be used to dynamically redirect to another force.com site. The use case is that I'd like to migrate references to older content on another platform over to hitting a part of a force.com site. My plan was to CNAME a rewriter-based site with the old server's domain name, and then have this rewriter site dynamically place the user on a part of another force.com site.

I wrote a URL ReWriter class, and I'm assuming it's the mapping method that is doing all the work in this scenario. My debug code shows that the proper page reference is being set up and returned by the mapper method. When I visit the site (sandbox currently), I'm taken to whatever page is configured as the 401 Unauthorized page, even though I'm not referencing any platform data whatsoever (this is pure Apex logic). I've tried allowing the URL ReWriter class in Public Access Settings. The debug log doesn't even show any messaging related to why the unauthorized page is being shown.

It looks like everything but the actual redirect/URL rewrite is happening as written, but I have nowhere to go at this point. Any insight is appreciated.