.htaccess - htaccess SetEnvIf 为真

标签 .htaccess

如果我想在评估 RewriteRules 之前设置一个环境变量,I have to use SetEnvIf instead of SetEnv .然而,SetEnvIf需要一个条件。照原样,我有:

SetEnvIf Request_Method ^ ENV=VALUE

有一个更好的方法吗?

最佳答案

您可以使用 mod_rewrite 的 E旗帜:

RewriteRule ^ - [E=ENV:VALUE]

这将保证在应用规则之前(或之后)设置它。

关于.htaccess - htaccess SetEnvIf 为真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12031623/

相关文章:

.htaccess - 重定向到 Https 排除子域,但无论 WWW 与否

asp.net - 如何使用 htaccess 将 .aspx 重写为 .html 或 .php

.htaccess - Joomla 链接在实时站点上正常,但在本地服务器上不正确

python - 如何处理 Python Bottle 和 Apache .htaccess 中的 URL 重新路由?

apache2 - 给定页面的 https 重定向到 http

.htaccess - 为我的 sitemap.xml 重写规则 .htaccess

php - Zend Framework 上的公共(public)文件夹

windows - Windows 服务器上的 .htaccess 文件

php - wordpress http 到 https 重定向不起作用

.htaccess 重写类别和产品的规则