修改内容类型的Helicon Ape .htaccess RewriteRule的解决方法问题

时间:2018-04-19 17:14:31

标签: .htaccess iis-7.5 coldfusion-10 cfwheels helicon-ape

问题:

在IIS7.5中使用带有最后一个RewriteRule的Helicon Ape中的.htaccess,当取消注释时,会从Chrome检查器查看的响应标题中删除Content-Type(请参阅下面的示例屏幕截图)。这发生在/ flex2gateway / path上,它应该产生一个Content-Type of application / x-amf:

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)($|/.*$) [NC]
RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]

上一次RewriteRule的结果:

Results from the last RewriteRule

结果应该是什么,或者最后一次RewriteRule被注释掉

Results as they should be or when the last RewriteRule is commented out

我尝试过多种解决方法,包括添加以下内容,但没有解决问题:

RewriteRule ^flex2gateway/$ [NS,T=application/x-amp,L]

2 个答案:

答案 0 :(得分:2)

我终于明白了,当然这是一个简单的解决方法!

只需将jakarta|添加到RewriteCond模式:

RewriteCond %{REQUEST_URI} !^.*/(jakarta|flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|lucee|files|images|javascripts|miscellaneous|stylesheets|robots.txt|favicon.ico|sitemap.xml|rewrite.cfm)($|/.*$) [NC]

ColdFusion 10现在使用/jakarta/isapi_redirect.dll来处理flex2gateway路径。

答案 1 :(得分:0)

文件夹 flex2gateway 实际上存在,当您尝试获取" / flex2gateway /"路径,它试图返回目录列表。

尝试为此添加规则:

RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} ^.*/(flex2gateway|jrunscripts|cfide|cfformgateway|cffileservlet|railo-context|lucee|files|images|javascripts|miscellaneous|stylesheets)(/?)$[NC]
RewriteRule ^(.*)$ ./rewrite.cfm/$1 [NS,L]

将重定向到" ./ rewrite.cfm / $ 1"脚本。将其更改为您的首选目标。