What is the difference between SCRIPT_FILENAME and REQUEST_FILENAME?

Asked

Viewed 315 times

5

I am studying URL friendly, and in many examples I came across these two forms of writing:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

and

RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d

What is the difference between them? Looking at the Apache documentation I understood that they are the same thing. Did I get it right?

  • 1

    The value is the same, in principle. REQUEST_FILENAME is to make pair as REQUEST_URI, I never saw anything talking about any case that was not the same value. In theory, they point to the same internal structure of Apache. I have no idea why I have both. I would have to look at old documentation to see if before it was just SCRIPT_FILENAME, then it would make sense a new "nickname" later, to combine with REQUEST_URI, as I commented. However, it is a legitimate doubt.

  • Thank you so much for helping @Bacco :D

1 answer

1


SCRIPT_FILENAME : It is the name of the generally known CGI variable

REQUEST_FILENAME : It is the appropriate counterpart of REQUEST_URI (which contains the value of the Uri field of request_rec).

Both contain the same value.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.