gpt4 book ai didi

html - 使用 apache 注入(inject) html

转载 作者:行者123 更新时间:2023-11-28 03:43:08 26 4
gpt4 key购买 nike

我有一个位于 Apache 虚拟主机下的门户。它的所有 .css 和 .js 都是由底层 tomcat Web 应用程序动态生成的。我想要做的是在服务提供之前将我自己的一些 .css 和 .js 注入(inject)到组合中。我想我需要类似 mod_rewrite 的东西,但用于 html。

我知道我可以尝试搭载在每个页面上使用的一些资源引用并以这种方式使用 mod_rewrite,但这很难做到,我需要最后应用我的 css。

告诉我这有一些魔 bean 。我只需要在 处注入(inject)几个脚本和样式。

最佳答案

我以前没有用过,但看起来像mod_ext_filter可以做到这一点

通过查看示例,您可以尝试以下 Perl 脚本

#!/usr/local/bin/perl -w
use strict;

my $extraCode = "<script src=\"http:/...\"></script>";

while (<STDIN>) {
s/<\/head>/$extraCode<\/head>/i;
print;
}

在我发布这个之后,我注意到有人推荐了 https://serverfault.com/questions/46449/how-to-inject-html-code-into-every-delivered-html-page . mod_proxy_html 和 mod_sed 看起来不错

关于html - 使用 apache 注入(inject) html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8992182/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com