English Français Deutsch Italiano Dansk Español

htaccess File

On the root level you may need to define that the default file is the index.php

/.htaccess

DirectoryIndex index.php

If you want pretty URLs then set also the following lines and set in the configuration file $swSimpleURL = true;

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?name=$1 [L,QSA]

You may want to define browser cache for media

ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType image/gif "access plus 700000 seconds"
ExpiresByType image/jpeg "access plus 700000 seconds"
ExpiresByType image/png "access plus 700000 seconds"
ExpiresByType audio/mp3 "access plus 700000 seconds"
ExpiresByType text/css "access plus 700000 seconds"
ExpiresByType text/javascript "access plus 700000 seconds"
ExpiresByType application/javascript "access plus 700000 seconds"

You may want to prevent access directly to the files in the site folder

/site/.htaccess

< Files ~ ".php$">
Order allow,deny
Deny from all
< /Files>
< Files ~ ".txt$">
Order allow,deny
Deny from all
< /Files>

You may also want to make a .htaccess file for the file folder to declare filetypes and prevent hotlinking

/site/files/.htaccess

DirectoryIndex index.php
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?name=$1 [L,QSA]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www.)?yoursite.com [NC]
RewriteRule .(jpg|jpeg|png|gif|pdf|xls|docx)$ - [NC,F,L]