The .htaccess File
About the .htaccess file for la.plume micro CMS
The system requires an .htaccess file in the website root folder. That's the reason why la.plume micro CMS must be installed on Apache web server, not a Windows server (Windows does not support the use of .htaccess).
Note! The .htaccess file is not a web page but is a special type of invisible file that 'informs' Apache web server how to process requests for web pages.
The default .htaccess file that comes with the download is as follows:
AddDefaultCharset UTF-8
#
ErrorDocument 404 /error404.php
#
Options +FollowSymLinks
RewriteEngine on
#
# Forbid the following
RewriteCond %{REQUEST_URI} ^/cms/inc/list\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/inc/menu\.php$
RewriteRule .* - [F]
#
# Rewrite "contact" to "contact.php"
RewriteRule ^(contact)$ /$1.php [L]
#
# Rewrite "string" everything to /cms folder
RewriteCond %{REQUEST_URI} !^/index$
RewriteRule ^([A-Za-z0-9_\-]+)$ /cms/$1.php [L]
#
# Rewrite "/" to "/cms/index.php"
RewriteRule ^$ /cms/index.php [L]
#
# Rewrite "/cms/string.php" to "/string"
# Use THE_REQUEST to prevent infinite loops
RewriteCond %{THE_REQUEST} ^GET\ /cms/[^.]+\.php\ HTTP/
RewriteRule ^(cms)/([A-Za-z0-9_\-]+)\.php$ /$2 [R=301,L]
#
# For "/index" from above rule
Redirect 301 /index http://www.yourdomain.com/
#
# Canonical url fix (optional - see readme.txt)
# RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
# RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
#
Note! On some shared web hosting accounts, the .htaccess file can't be seen when the root folder is opened in an FTP client. This can often be corrected by enabling server side filtering in the FTP client program and setting the remote filter as -rtaF. The precise details may vary from one program to another.
Explanation of the default .htaccess file
The file does a number of important things, some of which are explained here.
# Forbid the following
RewriteCond %{REQUEST_URI} ^/cms/inc/list\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/inc/menu\.php$
RewriteRule .* - [F]
The above forbids the file list (list.php) and menu (menu.php) from being viewed in a browser by themselves.
# Rewrite "string" everything to /cms folder
RewriteCond %{REQUEST_URI} !^/index$
RewriteRule ^([A-Za-z0-9_\-]+)$ /cms/$1.php [L]
The above ensures that the website's pages (which are physically located in the /cms folder) are viewed in a browser as if they are in the website's root folder. Note that the RewriteRule deliberately does not allow dots to be included in a page's web address, so if you intend to install the system on a subdomain.yourdomain.com the rule will need to be revised to suit.
The above rule also eliminates the superfluous .php file suffix in page addresses.
# Rewrite "/cms/string.php" to "/string"
# Use THE_REQUEST to prevent infinite loops
RewriteCond %{THE_REQUEST} ^GET\ /cms/[^.]+\.php\ HTTP/
RewriteRule ^(cms)/([A-Za-z0-9_\-]+)\.php$ /$2 [R=301,L]
The above prevents the website's pages being viewed in their 'physical' /cms folder, so that they don't become 'duplicates' as indexed by search engines. The 'physical' address of this page is www.mini-print.com/cms/-htaccess.php but only the correct www.mini-print.com/-htaccess can be viewed in a browser.
# Canonical url fix (optional - see readme.txt)
# RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
# RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]
The above, when 'un-commented' by removing the orange # symbols, enforces the 'canonical' url, so that a www.domain can't be viewed without the www. Again, this is to prevent 'duplicates' being indexed by search engines. If your website does not use www, the following can be entered instead:
# Canonical url fix (optional - see readme.txt)
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com [NC]
RewriteRule (.*) http://yourdomain.com/$1 [R=301,L]
Note! Replace yourdomain.com with your real domain name, adding the \ (backslash) before any dots, as indicated.
More about Apache web server and .htaccess is available at WebmasterWorld's Apache web server library »