I have logout url in my salesforce communities header url.I want to redirect to my custom login page of my communities.Currently its redirecting to standard salesforce login page.

<apex:page title="{!$Label.site.site_login}" showHeader="false" sidebar="false" standardStylesheets="false">

    <html lang="en">
        <nav class="navbar navbar-static-top navbar-inverse" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                <div class="collapse navbar-collapse navbar-ex1-collapse" id="tabs">
                    <ul class="nav navbar-nav">
                        <li id="Home">
                            <apex:outputLink value="{!$Page.Home}">Home</apex:outputLink>
                        <li id="chatter">
                            <apex:outputLink value="{!$Page.Chatter}">Chatter</apex:outputLink>
                        <li id="events">
                            <apex:outputLink value="{!$Page.Events}">Events</apex:outputLink>
                        <li id="answers">
                            <apex:outputLink value="{!$Page.Answers}">Answers</apex:outputLink>
                        <li id="logout">
                            <apex:outputLink value="{!$Site.Prefix}/secur/logout.jsp">Log Out</apex:outputLink>

3 Answers 3


I created my own log out page and add the following visualforce code.

The code loads the branded logout page hidden in the background for 5 seconds before being redirected to the login page.

<apex:page showHeader="false" sidebar="false">
  <apex:iframe src="{!$Site.Prefix}/secur/logout.jsp" height="1" width="1" />
    function redirectToLogin(){
    setTimeout("redirectToLogin()", 500);
  Logging out...
  • Awesome. That worked! Thank you so much for posting it. Aug 12, 2014 at 18:11

You can build your own logout page and load the Salesforce logout page within a hidden iframe on that page.

<!-- Log out of the community -->
<iframe style="height:0px;overflow:hidden;" src="/secur/logout.jsp" />

<!-- Redirect with or without delay -->
    jQuery(document).ready( function() {
            document.location = {!BLANKVALUE($CurrentPage.Parameters.retURL,'CUSTOM URL HERE')}";
        {!BLANKVALUE($CurrentPage.Parameters.delay, '4500')} ); 

As of the Winter '15 release, you can set a custom logout page URL under
Administration Settings > Login & Registration.

Check out the documentation here:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .