htaccess ForceType 应用程序/x-httpd-php
这可能看起来有点奇怪,但我们正在使用
<Files "*">
ForceType application/x-httpd-php
</Files>
这当然会强制所有文件提供 html/php 标头。我这样做的原因是因为我们使用了一堆无扩展名的 php 文件。我知道有很多更有效的方法可以做到这一点,但我的老板有他奇怪的理由。
现在我打赌你已经可以发现这个问题了,不需要我进一步说明吗?
是的,你的 .jpg .css 等怎么样?是的,这正是问题所在。将它们全部移动到新目录并更新所有模板将只需要几个小时。
那么基本上我如何匹配除 (.css|.js|.jpg) 之外的所有文件,或者只匹配没有扩展名的文件?我想什么更有效率......
有什么想法吗?
This is probably going to seem a little strange but we are using
<Files "*">
ForceType application/x-httpd-php
</Files>
Which of course forces all files to give html/php headers.. The reason I am doing this way is because were using a bunch of extention'less php files. I know there is plenty more efficient ways of doing this but my boss has his bizarre reasons.
Now I bet you can already spot the problem with this , without me going any further?
Yes what about your .jpg .css etc well yes thats the exactly the problem here .. moving them all to a new directory and updating all the templates would simply take hours.
So basically how I could match all except say (.css|.js|.jpg) or maybe only match files with no extension? what ever is more efficient I guess..
Any Ideas guys?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 指令。
也许
Try the <FilesMatch> directive.
Perhaps