function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
abhishek guptaabhishek gupta 

URL rewriter class not getting excecuted

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

Gunners_23Gunners_23

Please refer the below link for example

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_site_urlRewriter.htm

 

For "enabling url rewriting in the site" 

 

Go to "App Setup"--->Develop--->Sites--->Edit

 

In the URL Rewriter Class LookUp field select the "URL Rewriter class" which you've written

abhishek guptaabhishek gupta

i am providing the url rewriter class in the look up field still it is not working for me.

Amey PriolkarAmey Priolkar
Did you try providing the site access of the URL Rewriter class?
Antra Shrivastava 8Antra Shrivastava 8
Hi All,

The Url rewriting class does not work when email is passed in url and the email passed contains dot(.)
Can anyone help with this??