diff --git a/utils/generate_apache_config.pl b/utils/generate_apache_config.pl
index 9d9e94e10..664b4c819 100755
--- a/utils/generate_apache_config.pl
+++ b/utils/generate_apache_config.pl
@@ -55,6 +55,22 @@ DocumentRoot /usr/share/zoneminder/www
qq`
ErrorLog $$opts{error_log}
+Alias /zm/cache "/var/cache/zoneminder/cache"
+Alias /cache "/var/cache/zoneminder/cache"
+
+ Options -Indexes +FollowSymLinks
+ AllowOverride None
+
+ # Apache 2.4
+ Require all granted
+
+
+ # Apache 2.2
+ Order deny,allow
+ Allow from all
+
+
+
ScriptAlias /zm/cgi-bin/ /usr/lib/zoneminder/cgi-bin/
ScriptAlias /cgi-bin/ /usr/lib/zoneminder/cgi-bin/
@@ -67,7 +83,6 @@ ScriptAlias /cgi-bin/ /usr/lib/zoneminder/cgi-bin/
Alias /zm /usr/share/zoneminder/www
-
php_flag register_globals off
Options +Indexes +FollowSymLinks
@@ -81,6 +96,32 @@ Alias /zm /usr/share/zoneminder/www
Allow from all
+
+# For better visibility, the following directives have been migrated from the
+# default .htaccess files included with the CakePHP project.
+# Parameters not set here are inherited from the parent directive above.
+
+ RewriteEngine on
+ RewriteRule ^$ app/webroot/ [L]
+ RewriteRule (.*) app/webroot/$1 [L]
+ RewriteBase /zm/api
+
+
+
+ RewriteEngine on
+ RewriteRule ^$ webroot/ [L]
+ RewriteRule (.*) webroot/$1 [L]
+ RewriteBase /zm/api
+
+
+
+ RewriteEngine On
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^ index.php [L]
+ RewriteBase /zm/api
+
+
`;
if ( $$opts{protocol} eq 'https' ) {
$template .= qq`