简体   繁体   中英

What means e in htaccess?

I want to add a non-parameter canonical link to all parametrized URLs. 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} . What means this e in this context?

The e is the syntax used by mod_headers to reference an environmental variable:

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

%{VARNAME}e The contents of the environment variable VARNAME.


Note: I know this is old, but I had the same question and the PHP answer is of no relevance to htaccess.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM