diff --git a/NEWS.txt b/NEWS.txt
index b3d53e2f3a9fc20cff7f305207a594b1326feaad..df77676a45440776cb11e5665dead8cbaa32f6e9 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -25,7 +25,9 @@ General
 	* Automatic version-numbers of CSS and JS files to avoid caching problems: This feature provides automatic numbering of CSS and JS files using the files modified timestamp. This way the file reference will change when a CSS or JS files is changed, and by this the browser and proxy will re-cache the file. Can be configured to include the timestamp within the the filename (before .ext) or as a parameter to the file (default).
 	  If versioning is done inside the filename (by setting $TYPO3_CONF_VARS[BE][versionNumberInFilename] to true) you need this line as the first rewrite rule in .htaccess:
 		# Rule for versioned static files (see $TYPO3_CONF_VARS[BE][versionNumberInFilename])
-		RewriteRule ^(.+)\.(.+\d)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
+		RewriteCond %{REQUEST_FILENAME} !-f
+		RewriteCond %{REQUEST_FILENAME} !-d
+		RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
 	  IMPORTANT: this rule has to be the very first rule to work properly, at least it has to be placed before the (^typo3...) rewrite rule
 	  Developers can use this API for versioning of files in their own backend mods, by calling t3lib_div::createVersionNumberedFilename or using the core API for including files in the page renderer class.
 
diff --git a/misc/advanced.htaccess b/misc/advanced.htaccess
index 252ed5e925438a5dd61fcc5ef60efe269aa4df73..8043f050f02a698a6fce3b6a5aef0ec5e2396d28 100644
--- a/misc/advanced.htaccess
+++ b/misc/advanced.htaccess
@@ -69,7 +69,9 @@ RewriteEngine On
 #RewriteBase /
 
 # Rule for versioned static files (see $TYPO3_CONF_VARS[BE][versionNumberInFilename])
-RewriteRule ^(.+)\.(.+\d)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule ^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)$ $1.$3 [L]
 
 # Stop rewrite processing if we are in the typo3/ directory
 # For httpd.conf, use this line instead of the next one: