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

路由怎么写都不对…… 问题出在哪里了 #26

Closed
cwwjsyc opened this issue Oct 9, 2017 · 8 comments
Closed

路由怎么写都不对…… 问题出在哪里了 #26

cwwjsyc opened this issue Oct 9, 2017 · 8 comments

Comments

@cwwjsyc
Copy link

cwwjsyc commented Oct 9, 2017

//config/config.php 中写道
'routeRule' => array(
'demo' => 'demo',
'demo.html' => 'demo',
'/demo/'=>'demo',
),

//访问 http:///demo/ or http:///demo.html 都不对,显示404
求正解!

@billge1205
Copy link
Collaborator

基础路由不需要配置 /demo默认会定位到 controller目录下的 demoAction.php文件
你看下404是框架返回的还是nginx返回的 如果是nginx返回的说明nginx配置的不对 具体配置参考wiki http://www.billge.cc 环境配置

@cwwjsyc
Copy link
Author

cwwjsyc commented Oct 10, 2017

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.

Error 404

biny.site
Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.21

@cwwjsyc
Copy link
Author

cwwjsyc commented Oct 10, 2017

<VirtualHost *:80>
ServerName biny.site
DocumentRoot "C:/XAMMP/htdocs/biny/web"
<Directory "C:/XAMMP/htdocs/biny">
AllowOverride All
Order Allow,Deny
Allow from all

@cwwjsyc
Copy link
Author

cwwjsyc commented Oct 10, 2017

按照这个配置,我也不知道问题出在哪里了

@billge1205
Copy link
Collaborator

看起来是apache的错误 并没有走到index.php里 apache配置我不是很清楚 nginx最主要是try files的配置 apache
应该也有类似的配置

@cwwjsyc
Copy link
Author

cwwjsyc commented Oct 10, 2017

既然定位是给入门者使用的框架,那么应该支持Apache+PHP的环境。建议写个.htaccess文件处理下try files的问题

@billge1205
Copy link
Collaborator

嗯 谢谢你的建议 晚点会更新wiki

@billge1205
Copy link
Collaborator

已更新wiki 试试看下面这个配置
DocumentRoot "/data/billge/biny/web/"

<Directory "/data/billge/biny/web/">
    RewriteEngine on
    # 如果请求的是真实存在的文件或目录,直接访问
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # 如果请求的不是真实文件或目录,分发请求至 index.php
    RewriteRule . index.php

    # ...other settings...  

</Directory> 

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

2 participants