cfwheels / cfwheels

An open source ColdFusion framework inspired by Ruby on Rails.
https://cfwheels.org/
Apache License 2.0
199 stars 105 forks source link

URL Rewrite Giving me "<cfinclude template="wheels/index.cfm">" #825

Closed damemory closed 6 years ago

damemory commented 6 years ago

Using the following in .htaccess file I recieve this <cfinclude template="wheels/index.cfm">. Direct *.cfm requests work, but somehow it loses it's content type after the rewrite.

Server: Apache OS: Linux Firewall: F5 CF Ver = 11 patched. RewriteEngine = on.

Any ideas?

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^.*/index.cfm/(.*)$ [NC]
RewriteRule ^.*/index.cfm/(.*)$ ./rewrite.cfm/$1 [NS,L]

RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|fonts|cfide|cfformgateway|cffileservlet|railo-context|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm|remote)($|/.*$) [NC]
RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]
neokoenig commented 6 years ago

Why have you got rewrite.php in there? !

Try:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^.*/index.cfm/(.*)$ [NC]
RewriteRule ^.*/index.cfm/(.*)$ ./rewrite.cfm/$1 [NS,L]
RewriteCond %{REQUEST_URI} !^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|lucee|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm|remote)($|/.*$) [NC]
RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]
damemory commented 6 years ago

Sorry just updated it with original. *.php was just a rewrite test.

neokoenig commented 6 years ago

So if your server is serving ".cfm" files directly, then it sounds like the request is not being properly proxied to Tomcat - so Apache doesn't recognise that CFM should be proxied off to lucee/ACF, and is instead serving them as plain text as it doesn't know what to do with them.

I haven't run ACF in a while (I'm generally on Lucee) so can't be loads of help, but check that you've got DirectoryIndex index.cfm in your vHost config for a start as it might be as simple as it not knowing what the default document for that vHost is.

neokoenig commented 6 years ago

Closing, feel free to reopen if there's more information