是否可以拆分 .htaccess 文件?

发布于 2024-09-11 11:03:50 字数 1459 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

咋地 2024-09-18 11:03:50

如果您可以完全控制这两个系统,请使用 Apache httpd.conf 文件。它可以处理 .htaccess 可以处理的所有内容,甚至更多,出于速度和安全原因,它比 .htaccess 更受青睐。

如果由于某种原因您需要将设置划分到多个文件中(例如,某些设置在系统中是通用的,应该受到版本控制,而其他设置则不是),您可以在 httpd.conf 文件中使用 include 指令,如 S.Lott 所说。

如果您无法控制两个系统中的httpd.conf,我不知道那里是否支持包含指令;但是,您可以尝试在 htaccess 文件中使用条件块,如此处< /a>.

If you have complete control over both systems, use the Apache httpd.conf file. It can handle everything that .htaccess can and more, and is preferred above .htaccess for speed and security reasons.

If for some reason you need to divide the settings over multiple files (eg. some settings are common among the systems and should be under version control, others not), you can use include directives in the httpd.conf file like S.Lott says.

If you don't have control over httpd.conf in both systems, I don't know whether include directives are supported there; however you could try to use conditional blocks in your htaccess file as explained here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文