gpt4 book ai didi

apache - RewriteEngine 每次都在 中打开?

转载 作者:行者123 更新时间:2023-12-04 00:47:18 24 4
gpt4 key购买 nike

我想知道当它嵌入 IfModule mod_rewrite.c 时,我是否只能在我的 htaccess 中使用 RewriteEngine On 一次,还是我必须每次都使用它,因为它是嵌入的?

请参阅下面的示例。谢谢

<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} /?author [NC]
RewriteRule .* - [F]
</ifModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} g= [NC]
RewriteRule ^(.*)$ - [F,L]
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

最佳答案

您应该能够对所有重写代码进行一次检查。

我从您的代码中怀疑您正在使用的站点将无法正常运行,或者根本未启用 mod_rewrite。在这种情况下,我会完全省略对 mod_rewrite 的检查,如果未启用,则让网络服务器失败。

如果您最终遇到将代码安装在未启用 mod_rewrite 的网络服务器上的情况,那么调试和查明确切问题会容易得多。

关于apache - RewriteEngine 每次都在 <IfModule mod_rewrite.c> 中打开?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17636382/

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