With the Symphony CMS Maintenance Mode extension, the application can be set to redirect all pages to a page that has been given a type of “maintenance”. If all you need is to replace the home page with a temporary page, just change the .htaccess file.
The default Symphony .htaccess file for the root directory of the site looks like this:
### Symphony 2.0 - Do not edit ###
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
### DO NOT APPLY RULES WHEN REQUESTING "favicon.ico"
RewriteCond %{REQUEST_FILENAME} favicon.ico [NC]
RewriteRule .* - [S=14]
### IMAGE RULES
RewriteRule ^image/(.+.(jpg|gif|jpeg|png|bmp))$ /extensions/jit_image_manipulation/lib/image.php?param=$1 [L,NC]
### CHECK FOR TRAILING SLASH - Will ignore files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /$1/ [L,R=301]
### MAIN REWRITE - This will ignore directories
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /index.php?page=$1&%{QUERY_STRING} [L]
</IfModule>
DirectoryIndex index.php
<IfModule mod_autoindex.c>
IndexIgnore *
</IfModule>
######
This file helps control the page redirects for Symphony. I tend to ignore the instruction not to edit this file, primarily because I want to be able to access HTML files in subdirectories by navigating to the folder that contains an index.html
file. The DirectoryIndex
Apache configuration directive includes only index.php
files, so trying to navigate to an index.html
file by navigating to the parent directory will result in a “404 Page Not Found” error. To solve this issue, simply modify the .htaccess file to look for index.html
files as well:
DirectoryIndex index.php index.html
Now, if you wanted to set up a temporary page, create an index.html
file and place it at the root of the site. Then, tell Apache to look for the HTML file first by changing the order of the list of directory index files to look for. If one of these types of files is not available, Apache will fall back to the next available file type.
DirectoryIndex index.html index.php
This is a sort of pseudo maintenance mode. All other Symphony pages will still be accessible, so it’s not quite the same as putting the site into maintenance mode with the Maintenance Mode extension.
The default install of Symphony comes with a Login event. By attaching this event to all pages, access to these pages can be prevented for everyone except authenticated admin users, whether authors or developers, by using some XSLT logic. If you have only one (or just a few) master templates, you may use an XSL choose statement there.
In a Symphony default installation you may replace
<xsl:apply-templates/>
in your master.xsl
file with
<xsl:choose>
<xsl:when test="$is-logged-in = 'true'">
<xsl:apply-templates/>
</xsl:when>
<xsl:otherwise>
<p>Sorry. we're closed.</p>
</xsl:otherwise>
</xsl:choose>
and you will be fine. (Thanks to michael-e for this tip.)
DesignProjectX | The digital sandbox of Stephen Bau