纸帆|ZevenFang

我们终其一生寻找的无非是那个甘愿为你停下脚步,为你驻足的人。

0%

docker容器apache安装rewrite模块

进入容器内部:

1
2
a2enmod rewrite # 安装模块
service apache2 restart # 重启容器

编辑.htaccess文件:

1
2
3
4
5
6
7
8
9
<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]

</IfModule>

查看是否开启成功:
执行phpinfo()函数,搜索mod_rewrite

使用镜像:
zevenfang/docker-apache-php7