mac下配置yii2 apache

当apache2的 httpd-vhosts.conf 设置的文件权限 与 .htaccess 的rewrite规则相冲突时,会报 403错误

<VirtualHost *:80>
    ServerName y2.com
    #DocumentRoot "/Library/WebServer/Documents/yii2-ace-admin/backend/web/"
    DocumentRoot "/Users/mrchow/Sites/yii2-ace-admin/backend/web/"

   # <Directory "/Library/WebServer/Documents/yii2-ace-admin/backend/web/">
    <Directory "/Users/mrchow/Sites/yii2-ace-admin/backend/web/">
        # 重定向规则
        # use mod_rewrite for pretty URL support
        RewriteEngine on
        # If a directory or a file exists, use the request directly
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        # Otherwise forward the request to index.php
        RewriteRule . index.php

        # use index.php as index file
        DirectoryIndex index.php

        # 文件权限
        Options FollowSymLinks Multiviews
        MultiviewsMatch Any
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

相关推荐