开发者

Apache FilesMatch

开发者 https://www.devze.com 2023-01-25 06:45 出处:网络
With Apache, I can target files by extension like this: <FilesMatch \"\\.(gif|jpg|png|js|css)$\">

With Apache, I can target files by extension like this:

<FilesMatch "\.(gif|jpg|png|js|css)$">
开发者_运维问答

Can you also target specific files by their entire filename. For example "bg.jpg":

<FilesMatch "bg.jpg">

Would that work?

Thanks, Ben


Yes, that will work but you need to escape the dot (\.) if you want to use FilesMatch. You could also simply use Files.


It's a regular expression, which means you should anchor it with a caret "^" in front and a dollar sign "$" at the end. Plus escape the dot, as joschi said.

0

精彩评论

暂无评论...
验证码 换一张
取 消