如果我有 abc.php 文件,但我希望通过网络将其作为 js 文件进行访问,例如 http://xyz.com/abc.js?m=1&x=3 为此目的Apache的 ForceType 更好OR RewriteRule ???
我知道两者都有效,但想知道哪一个是正确的。哪一个在速度方面表现更好。
答案 0 :(得分:0)
为此,我更喜欢RewriteRule,因为你不强迫所有的php文件充当js
RewriteRule ^ /?abc.js。* $ http://xyz.com/abc.php?$ 1 [PT,L]应该可以正常工作。