diff --git a/.htaccess b/.htaccess
index 5c11eff9f372a9f0487c5dfd43b04342343965c7..d82cb8ade178cdfedcbe09f340ac292d79bf2f7b 100644
--- a/.htaccess
+++ b/.htaccess
@@ -44,19 +44,18 @@
   RewriteRule ^(build|tests|config|lib|3rdparty|templates)/.* - [R=404,L]
   RewriteRule ^(\.|autotest|occ|issue|indie|db_|console).* - [R=404,L]
 
-  <IfModule mod_env.c>
-    SetEnv front_controller_active true
-    RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]
-    RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]
-    RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff)$
-    RewriteCond %{REQUEST_FILENAME} !/remote.php
-    RewriteCond %{REQUEST_FILENAME} !/public.php
-    RewriteCond %{REQUEST_FILENAME} !/cron.php
-    RewriteCond %{REQUEST_FILENAME} !/status.php
-    RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php
-    RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php
-    RewriteRule .* index.php [PT,E=PATH_INFO:$1]
-  </IfModule>
+  # Rewrite rules for `front_controller_active`
+  RewriteRule ^core/js/oc.js$ index.php [PT,E=PATH_INFO:$1]
+  RewriteRule ^core/preview.png$ index.php [PT,E=PATH_INFO:$1]
+  RewriteCond %{REQUEST_FILENAME} !\.(css|js|svg|gif|png|html|ttf|woff)$
+  RewriteCond %{REQUEST_FILENAME} !/remote.php
+  RewriteCond %{REQUEST_FILENAME} !/public.php
+  RewriteCond %{REQUEST_FILENAME} !/cron.php
+  RewriteCond %{REQUEST_FILENAME} !/core/ajax/update.php
+  RewriteCond %{REQUEST_FILENAME} !/status.php
+  RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php
+  RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php
+  RewriteRule .* index.php [PT,E=PATH_INFO:$1]
 
 </IfModule>
 <IfModule mod_mime.c>
diff --git a/lib/private/setup.php b/lib/private/setup.php
index 1f91240e9da3d7722956ca598046fd064415308b..4a4b935df0316379be1cf1a405dbab0759a0d453 100644
--- a/lib/private/setup.php
+++ b/lib/private/setup.php
@@ -436,6 +436,9 @@ class Setup {
 		// Add rewrite base
 		$content.="\n<IfModule mod_rewrite.c>";
 		$content.="\n  RewriteBase ".\OC::$WEBROOT;
+		$content .= "\n  <IfModule mod_env.c>";
+		$content .= "\n    SetEnv front_controller_active true";
+		$content.="\n  </IfModule>";
 		$content.="\n</IfModule>";
 
 		if ($content !== '') {
diff --git a/version.php b/version.php
index 68ed5c9c21760d5ae6e7e592669ccc3852ced3d5..ca90fdb31675b39021a29160f4cfaeaeea99c29c 100644
--- a/version.php
+++ b/version.php
@@ -25,7 +25,7 @@
 // We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades
 // between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
 // when updating major/minor version number.
-$OC_Version = array(9, 0, 0, 4);
+$OC_Version = array(9, 0, 0, 5);
 
 // The human readable string
 $OC_VersionString = '9.0 pre alpha';