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
souvik9086souvik9086 

Salesforce Site Issue

Hello Everyone,

This is an issue relating to page display in salesforce sites.
When we hit something in site url with .html extension the url rewritter class is not getting called.
How can that url rewritter be called so that within that class we can interpret that lets say index.html and then 
change it as per requirement lets say index(A vf page or anything).

Similarly if we hit a static resource url directly through site then the url gets accessed and the static resource image is displayed to the user.
But the requirement is that teh image should not be displayed. What is happening there is in this case also the url rewriter cass is not called, because if it is getting called then we can restrict the resource display in that class.

If anybody has solution to this that how come we can call the rewriter class in the above two scenarios, please post here.

Thanks
Here-n-nowHere-n-now
Rewritting only works for VF pages, not standard pages, images, or other types of targets (http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_site_urlRewriter.htm).  It also doesn't prevent direct access to the "true" URLs - it makes friendly URLs (alias) possible, but doesn't invalidate the original URLs in any way.
souvik9086souvik9086

Okay thanks.
Do you know  any way we can handle the restriction of static resource display after user hits the exact static resource URL in the site.

Is there any way we can able to display 404 ERROR page through the siteurl rewriter class.

Here-n-nowHere-n-now
As far as I know, no.  The UrlRewriter interface is not designed for access control at all, so it cannot be used to restrict.  Static Resource is not a place for information that's intended to be private either, as there's no access control around it.  If you need to restrict access to an image, consider storing it in a Document/ContentVersion record.