Meaning of "$" in . htaccess

Asked

Viewed 129 times

0

I am trying to understand the file . htaccess of my server however, I do not find nice reference on the net, I have the following question: What does $ no. htaccess mean?

Could someone tell me a good tutorial of . htaccess?

  • 2

    In Regexp $ means the end of string, but it can be something else if it is not Regexp what you are referring to... You can put the line that has what you are looking for see explained.

2 answers

0

Of documentation:

The . htaccess files (or "distributed configuration files") offer a way to make changes to the per-directory settings. A file, containing one or more settings guidelines, is placed in a particular directory, and the guidelines apply to that directory and all its subsequent subdirectories.

Maybe the apache documentation clarifies the concept more: https://httpd.apache.org/docs/2.4/howto/htaccess.html

0


The .htaccess uses regular expressions for settings. The character $ is an anchor to delimit the end of the string informed or until line break \n. Its opposite is the character ^, which will combine the occurrence of the start of the string or the line.

For example, the following expression:

  • [0-9]$ : Search for digits between 0 and 90 which are at the end of a string or line

Using the ^:

  • ^[0-9]$ : It will only search for a string or line that starts and ends with a digit between 0 and 9

Browser other questions tagged

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