The following .htaccess has been working perfectly 10+ years on my CentOS production server currently running Apache 2.4, the purpose being to process user/seo-friendly urls, but on my new dev laptop running Ubuntu 20.10 and the same Apache 2.4, the 404.cfm contents are displayed in the browser as plain text instead of the Lucee script being executed.
When I try ErrorDocument 404 /404.cfm instead of RewriteRule, 404.cfm executes, but it’s not able to access the original url because cgi.request_url has been changed to the 404.cfm.
What am I missing?
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !.cfm$
RewriteCond %{QUERY_STRING} !=“”
RewriteRule ^(.*)$ 404.cfm?404;http://%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING}
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !.cfm$
RewriteRule ^(.*)$ 404.cfm?404;http://%{HTTP_HOST}%{REQUEST_URI}
OS: Ubuntu 20.10
Java Version: 11.0.6
Tomcat Version: 9.0.31
Lucee Version: 5.3.7.48