nginx的location ~ .*.(?:htm|html)${root jimei-admin expires -1; }转换为apache
时间: 2023-02-21 12:21:23 浏览: 60
Apache 的等价配置如下:
```
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus -1 seconds"
<FilesMatch "\.(html|htm)$">
ExpiresDefault "access plus -1 seconds"
</FilesMatch>
</IfModule>
```
请注意,需要确保 Apache 已经安装了 mod_expires 模块并已启用。
相关问题
nginx的location ~ .*.(?:htm|html)${root jimei-admin }转换为apache
Apache 的相应配置如下:
```
<Directory "/var/www/jimei-admin">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<FilesMatch "\.(htm|html)$">
Options -Indexes
Require all granted
</FilesMatch>
```
nginx的location ~ .*\.(?:htm|html)$转换为apache
在Apache中,您可以使用下面的规则转换为类似于nginx中的location ~ .*\.(?:htm|html)$:
```
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} \.(html|htm)$
RewriteRule ^(.*)$ / [L]
</IfModule>
```
这段代码启用了Apache的重写模块,并且如果请求的URL以".html"或".htm"结尾,则将其重写为根目录。