Athan_D
1
I have a problem with regex in a location used to deny access to some
Drupal
directories and files.
location ~
.(engine|inc|info|install|module|profile|po|sh|.sql|theme|tpl(.php)?|xtmpl)$|^(code-style.pl|Entries.|Repository|Root|Tag|Template)$
{
return 404;
}
First part up to OR operator (|) works fine but seems to ignore the ^
operator (right next to |).
Trying to isolate the problem I used the following
location ~ ^code-style.pl$ {
return 404;
}
Unfortunately code-style.pl was still accessible. Is ^ (begin of)
operatior
supported in location context?
Thanks,
Athan
Athan_D
2
On Mon, Feb 11, 2008 at 12:04:35PM +0200, Athan D. wrote:
operator (right next to |).
Trying to isolate the problem I used the following
location ~ ^code-style.pl$ {
return 404;
}
Unfortunately code-style.pl was still accessible. Is ^ (begin of) operatior
supported in location context?
What begin are you mean ? Begin of URI or begin of level in directory ?
“^” is begin of all text. All URIs started from ‘/’.
You probably need
location ~ /code-style.pl$ {
Athan_D
3
“Igor S.” [email protected] wrote in message
news:[email protected]…
What begin are you mean ? Begin of URI or begin of level in directory ?
“^” is begin of all text. All URIs started from ‘/’.
My mistake!
You’re right Igor, in that case ^ means begin of all text not just
filename
part.
You probably need
location ~ /code-style.pl$ {
That works.
Thanks,
Athan