[英]What means e in htaccess?
I want to add a non-parameter canonical link to all parametrized URLs.我想向所有参数化 URL 添加一个非参数规范链接。 I try to do this on the following way:
我尝试通过以下方式做到这一点:
<IfModule mod_rewrite.c>
### Catching all URLs with non-empty parameter ###
RewriteCond %{QUERY_STRING} .
### Adding to all parametrized URLs an environment variable ###
RewriteRule .* : [E=MY_HEAD:1]
</IfModule>
<IfModule mod_headers.c>
### Setting a non-parametrized URL as canonical to all URLs with an environment variable
Header set Link '%{HTTP_HOST}%{REQUEST_URI}e; rel="canonical"' env=MY_HEAD
</IfModule>
My question is: looking for examples i found results with and without the e
after {REQUEST_URI}
.我的问题是:寻找示例,我在
{REQUEST_URI}
之后找到了带有和不带有e
结果。 What means this e
in this context?在这种情况下,这个
e
是什么意思?
The e
is the syntax used by mod_headers
to reference an environmental variable: e
是mod_headers
用于引用环境变量的语法:
https://httpd.apache.org/docs/current/mod/mod_headers.html#Header https://httpd.apache.org/docs/current/mod/mod_headers.html#Header
%{VARNAME}e The contents of the environment variable VARNAME.
%{VARNAME}e 环境变量 VARNAME 的内容。
Note: I know this is old, but I had the same question and the PHP answer is of no relevance to htaccess.注意:我知道这是旧的,但我有同样的问题,PHP 答案与 htaccess 无关。
The e Regex Modifier in PHP. PHP 中的 e 正则表达式修饰符。
The e modifier is a deprecated regex modifier which allows you to use PHP code within your regular expression. e 修饰符是一个已弃用的正则表达式修饰符,它允许您在正则表达式中使用 PHP 代码。 This means that whatever you parse in will be evaluated as a part of your program.
这意味着您解析的任何内容都将作为程序的一部分进行评估。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.