Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apache配置问题 #16

Open
xuxiao-peng opened this issue May 15, 2018 · 0 comments
Open

apache配置问题 #16

xuxiao-peng opened this issue May 15, 2018 · 0 comments

Comments

@xuxiao-peng
Copy link

我按照你的单域名配置之后,启动 apache 过程中遇到了如下的问题

Expected but saw

#
   <VirtualHost *:80>
    ServerName www.yii2.cn
    RewriteEngine on
    DocumentRoot d:/php/demo/yii2admin
    
    # 应用前端主要重写规则
    RewriteCond %{HTTP_HOST} ^www.yii2.cn$ [NC] 
    RewriteCond %{REQUEST_URI} !^/(backend/web|admin|storage/web)
    RewriteRule !^/frontend/web /frontend/web%{REQUEST_URI} [L]

    # 重定向的网页没有一个斜线(注释,如果必要的话)
    #RewriteCond %{REQUEST_URI} ^/admin/$
    #RewriteRule ^(/admin)/ $1 [L,R=301]
    # 禁止斜线重定向
    RewriteCond %{REQUEST_URI} ^/admin$
    RewriteRule ^/admin /backend/web/index.php [L]
    # 后端应用程序的主要重写规则
    RewriteCond %{REQUEST_URI} ^/admin
    RewriteRule ^/admin(.*) /backend/web$1 [L]
    
    <Directory />
        Options FollowSymLinks
        AllowOverride None
        AddDefaultCharset utf-8
    </Directory>
    <Directory "d:/php/demo/yii2admin/frontend/web">
        RewriteEngine on
        # 如果一个目录或一个文件存在,请直接使用请求
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        # 否则去请求 index.php
        RewriteRule . index.php

        Require all granted
    </Directory>
    <Directory "d:/php/demo/yii2admin/backend/web">
        RewriteEngine on
        # 如果一个目录或一个文件存在,请直接使用请求
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        # 否则去请求 index.php
        RewriteRule . index.php

        Require all granted
    </Directory>
    <Directory "d:/php/demo/yii2admin/storage/web">
        RewriteEngine on
        # 如果一个目录或一个文件存在,请直接使用请求
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        # 否则去请求 index.php
        RewriteRule . index.php

        Require all granted
    </Directory>
   
    <filesMatch "\.(env|htaccess|htpasswd|svn|git)">
        Require all denied
    </filesMatch>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant