Building public websites using Force.com Sites allows you to extend your Salesforce applications and data by creating public-facing websites and applications that run natively on the Salesforce platform. Since your sites are hosted on Force.com servers, there are no data integration issues, allowing you to focus on creating highly interactive, scalable websites. Force.com Sites are built using Visualforce and Apex, leveraging the data, content, and logic that resides in your Salesforce org.
You can configure your site to be publicly accessible or require authentication through Customer or Partner Portals. Force.com handles your site’s infrastructure, freeing you to concentrate on building applications for various use cases.
What are Force.com Sites?
Force.com Sites is a Salesforce feature that enables you to create public websites using Visualforce pages and Apex controllers. These sites run on Salesforce infrastructure and can access your org’s data through standard Salesforce security models. Available since API version 17.0, Force.com Sites provides a cost-effective way to extend your Salesforce data to external users without requiring Salesforce licenses.
Key capabilities:
- Host public websites on Force.com infrastructure
- Access Salesforce data through Visualforce and Apex
- Implement custom authentication or allow anonymous access
- Scale automatically with Salesforce platform resources
- Integrate with existing Salesforce workflows and processes
Common Use Cases for Force.com Sites
Corporate Website
Create a public-facing website using standard web elements such as CSS, Flash, and JavaScript frameworks (e.g., jQuery, YUI). Your corporate site can display real-time data from your Salesforce org, including product information, case studies, and contact forms that create leads directly in Salesforce.
Employee Intranet
Set up a company intranet that uses single sign-on, restricts access by IP address and time of day. Employee intranets can display personalized dashboards, company announcements, and internal resources while maintaining security through Salesforce profiles and permission sets.
Collect New Ideas
Host a public community forum for sharing and voting on Salesforce Ideas regarding your company’s products and services. This creates a feedback loop where customer suggestions are automatically captured as records in your Salesforce org.
Micro Sites
Create micro sites to collect feedback or allow people to sign up for webinars or marketing information. These lightweight sites can capture leads, process event registrations, and integrate with Salesforce campaigns for marketing automation.
Expose Product Information
Publish your company’s product catalog on a subdomain of your existing website with detailed descriptions, current pricing, and product images all pulled seamlessly and in real-time from your Salesforce org. This ensures your public site always reflects current inventory and pricing data.
How to Setup New Force.com Site
Setting up a new Force.com Site requires administrator permissions and follows a structured process. Start by navigating to Setup → User Interface → Sites and Domains → Sites in Salesforce Classic, or Setup → Sites and Domains → Sites in Lightning Experience.

Setup steps:
- Choose an available Force.com domain name for your organization
- Enter the name of your site and select a site administrator
- Configure the default web address and subdomain
- Set up SSL certificates if required for secure connections
- Define site-specific settings like session timeout and login page
The platform creates your new site in seconds, providing you with a unique URL and basic site structure.
Creating Page Templates and Layouts
After initial setup, create page templates to give your site a consistent look and feel that matches your corporate branding. Your site template provides the page layout and style sheet for your site, overriding formatting inherited from any associated portal.
Templates in Force.com Sites work similarly to Visualforce page layouts, allowing you to define:
- Header and footer sections
- Navigation menus and site structure
- CSS styling and responsive design elements
- JavaScript libraries and custom functionality
- SEO meta tags and analytics tracking
Force.com Sites Security and Permissions
Configuring permissions for your Force.com Site follows familiar Salesforce security patterns. Visitors to your site use a Guest user license and a Sites-specific profile. You configure permissions for this Sites-specific profile like any other profile in Salesforce.
Permission configuration options:
- Tab and record type access
- Page layout assignments
- Field-level security for standard and custom objects
- Object permissions (read, create, edit, delete) for site users
- IP address restrictions and login hours
Important access restrictions: Salesforce imposes additional access restrictions for Sites visitors. While visitors can read, create, edit, and delete custom objects, they can only read and create standard objects. Some objects like Products and Price Books only offer read access. Always check the current Salesforce documentation before designing your Force.com Site architecture.
Guest User Security Considerations
Guest users operate under strict security constraints to protect your org’s data:
- Cannot access sensitive standard objects like Users, Accounts (unless explicitly granted)
- Limited to 1,000 page views per hour per site
- Cannot execute DML operations on certain standard objects
- Subject to governor limits for anonymous Apex execution
- Cannot access encrypted fields or certain system fields
Monitoring and Debugging Force.com Sites
You can monitor Sites users by adding them to the Debug Log, though for public websites this provides a generic view of user actions. For more detailed debugging:
- Preview sites as an administrator to view debug information
- Add debug tags to Visualforce page footers
- Use Salesforce monitoring tools to track site performance
- Implement custom logging for business-critical operations
- Monitor governor limit usage for high-traffic sites
Performance Optimization
Force.com Sites performance depends on efficient Visualforce and Apex code:
- Use view state efficiently to minimize page load times
- Implement caching strategies for frequently accessed data
- Optimize SOQL queries to avoid governor limit issues
- Use static resources for CSS, JavaScript, and images
- Consider implementing pagination for large data sets
Force.com Sites vs Modern Alternatives
While Force.com Sites remains available, Salesforce has introduced newer technologies for public website development:
- Experience Cloud Sites: Modern replacement with Lightning components and better mobile support
- Lightning Web Components: Modern JavaScript framework for building responsive interfaces
- Salesforce CMS: Content management capabilities for marketing sites
- Heroku: Full-stack application platform for complex web applications
Consider these alternatives for new projects, especially those requiring modern web standards, mobile optimization, or advanced content management features.
Frequently Asked Questions
What is the difference between Force.com Sites and Experience Cloud?
Force.com Sites uses Visualforce pages and is primarily designed for public websites with anonymous access. Experience Cloud (formerly Community Cloud) uses Lightning components and is designed for authenticated user communities with more advanced features like collaboration tools, knowledge bases, and mobile apps.
Can Force.com Sites access all Salesforce objects?
No, Force.com Sites have restricted access to Salesforce objects. Guest users can read and create most custom objects but have limited access to standard objects. Objects like Products and Price Books are read-only, and sensitive objects like Users require special permissions.
How do I secure a Force.com Site?
Secure Force.com Sites by configuring the Guest user profile with minimal necessary permissions, implementing IP restrictions, using HTTPS for sensitive data, validating all user inputs in Apex controllers, and regularly reviewing access logs and debug information.
What are the governor limits for Force.com Sites?
Force.com Sites are subject to standard Salesforce governor limits including 1,000 page views per hour per site, standard Apex CPU time limits, SOQL query limits, and DML statement limits. High-traffic sites should implement efficient coding practices and consider caching strategies.
Can I use custom domains with Force.com Sites?
Yes, you can configure custom domains for Force.com Sites by setting up CNAME records in your DNS configuration. This allows your site to appear under your company’s domain while still being hosted on Salesforce infrastructure.