Htaccess Filesmatch file overview

I am trying to install drupal in a subdirectory of my website hosted on bluehost ...

This is a HUGE pain

I think the following lines from .htaccess is the problem. When I am currently navigatoe for mysite.com/subdir/install.php, I get error 403. However, when I output the β€œnegation” from the lines below, I stop receiving this error, so I suspect that this line causes all Problems.

My question is: can someone help me understand what is happening in the following code? Especially if you can break it with a component.

<FilesMatch "\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)(|~|\.sw[op]|\.bak|\.orig|\.save)?$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$"> Order allow,deny </FilesMatch> 
+4
source share
1 answer

FilesMatch allows FilesMatch to match files using a regular expression.

In the FilesMatch above, you have 4 sets of regular expressions, where 1 set has an extra extra set.

Basically, this is denied access (error 403) to any of the found files that are described in your regular expression sets.

For instance:

 \.(engine|inc ...)$| 

So, if the file ends with .engine or .inc or ... the rest of the rule prohibits access to it.

Then at the end of the first set of rules you have | , which, as in the previous example, means OR , therefore, if the first set of rules does not match, it starts the second, which is slightly different.

 ^(\..*|Entries.*|Repository)$ 

Here it is done the other way around, it matches if the file starts and ends with the given keyword, for example:

If the file starts with . followed by something, ( .* ) means something else, such as .htaccess or begins with Entries , followed by something, or it’s for sure a repository or ... to the end.

Then the following rule ^#.*#$ , This means that the file begins and ends with the # symbol as # , which is processed literally

And the last set of rules does the same in the first scan if the file ends with the specified extensions.

If you want to know more, I suggest you learn more about Perl Compatible Regular Exions (PCRE)

+6
source

Source: https://habr.com/ru/post/1501090/


All Articles