1

我想为所有参数化 URL 添加一个非参数规范链接。我尝试通过以下方式做到这一点:

<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>

我的问题是:寻找我发现有和没有eafter的结果的例子{REQUEST_URI}。在这种情况下,这意味着什么e

4

2 回答 2

2

e是用于mod_headers引用环境变量的语法:

https://httpd.apache.org/docs/current/mod/mod_headers.html#Header

%{VARNAME}e 环境变量 VARNAME 的内容。


注意:我知道这是旧的,但我有同样的问题,PHP 的答案与 htaccess 无关。

于 2021-02-19T12:17:15.380 回答
1

The e Regex Modifier in PHP.

The e modifier is a deprecated regex modifier which allows you to use PHP code within your regular expression. This means that whatever you parse in will be evaluated as a part of your program.

and also you can refer this

于 2018-12-05T15:27:06.930 回答