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?
2
Answers
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
e
is the syntax used bymod_headers
to reference an environmental variable:https://httpd.apache.org/docs/current/mod/mod_headers.html#Header
Note: I know this is old, but I had the same question and the PHP answer is of no relevance to htaccess.