yii2 配置apache
程序员文章站
2022-05-08 19:21:36
...
Apache VirtualHost
担心大家不使用nginx,这里把apache 虚拟主机的配置也整理出来,像我这么负责的人不多了:)
方法一
直接在apache 虚拟主机中配置rewrite规则
<VirtualHost *:80>
ServerName rbac.yii.local.com
DocumentRoot /home/www/yii/rbac/web
<Directory "/home/www/yii/rbac/web">
Require all granted
Allow from all
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</Directory>
</VirtualHost>
方法二
rewrite规则通过.htaccess文件实现
<VirtualHost *:8000>
ServerName rbac.yii.local.com
DocumentRoot /home/www/yii/rbac/web
</VirtualHost>
.htaccess 内容如下(在代码web文件下已有此文件)
Options +FollowSymLinks
IndexIgnore */*
RewriteEngine on
# if a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# otherwise forward it to index.php
RewriteRule . index.php
上一篇: jar文件的打包方法
下一篇: Ivy 的主要概念