diff --git a/configs/debian/apache/parts/domain.tpl b/configs/debian/apache/parts/domain.tpl
index 86b9cd0e9c..e5cb7ad03f 100644
--- a/configs/debian/apache/parts/domain.tpl
+++ b/configs/debian/apache/parts/domain.tpl
@@ -39,10 +39,11 @@
ProxySet connectiontimeout=5 timeout=7200
- RewriteEngine On
- RewriteCond %{REQUEST_URI} \.ph(p[3457]?|t|tml)$
- RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
- RewriteRule (.*) - [H=proxy:{PROXY_FCGI_URL},NC]
+
+ RewriteEngine On
+ RewriteCond %{REQUEST_FILENAME} -f
+ RewriteRule .* - [H=proxy:{PROXY_FCGI_URL},NC]
+
# SECTION mod_proxy_fcgi END.
# SECTION php_fpm END.
# SECTION php_enabled END.
diff --git a/configs/debian/apache/parts/domain_ssl.tpl b/configs/debian/apache/parts/domain_ssl.tpl
index 247be1bcb2..3e117d9822 100644
--- a/configs/debian/apache/parts/domain_ssl.tpl
+++ b/configs/debian/apache/parts/domain_ssl.tpl
@@ -38,10 +38,11 @@
ProxySet connectiontimeout=5 timeout=7200
- RewriteEngine On
- RewriteCond %{REQUEST_URI} \.ph(p[3457]?|t|tml)$
- RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
- RewriteRule (.*) - [H=proxy:{PROXY_FCGI_URL},NC]
+
+ RewriteEngine On
+ RewriteCond %{REQUEST_FILENAME} -f
+ RewriteRule .* - [H=proxy:{PROXY_FCGI_URL},NC]
+
# SECTION mod_proxy_fcgi END.
# SECTION php_fpm END.
# SECTION php_enabled END.