htaccess ForceType 应用程序/x-httpd-php

发布于 2024-09-08 14:12:51 字数 410 浏览 1 评论 0原文

这可能看起来有点奇怪,但我们正在使用

<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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄情伤 2024-09-15 14:12:51

尝试使用 指令。

也许

<FilesMatch "^[^\.]*$"> #Match files without a . in them - ekerner escaped period
    ForceType application/x-httpd-php
</FilesMatch>

Try the <FilesMatch> directive.

Perhaps

<FilesMatch "^[^\.]*$"> #Match files without a . in them - ekerner escaped period
    ForceType application/x-httpd-php
</FilesMatch>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文