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 中路由无法生效的问题 #87

Closed
MopLand opened this issue Mar 11, 2014 · 6 comments
Closed

关于 Apache 中路由无法生效的问题 #87

MopLand opened this issue Mar 11, 2014 · 6 comments

Comments

@MopLand
Copy link

MopLand commented Mar 11, 2014

现在想自定义这么一个路由规则:

$route = new Yaf\Route\Regex(
"#^/data/([^/]+)/([^/])+#", array('controller' => ":name", 'action'=>":action"), array( 1 => "name", 2=>"action" )
);

$dispatcher->getRouter()->addRoute('data', $route);

$routes = Yaf\Dispatcher::getInstance()->getRouter()->getRoutes();

页面提示:
Error Msg:Failed opening controller script E:\Sync\Works\Yaf\portal\controllers:name.php: No such file or directory

但奇怪的是在 Nginx 下却完全正常。

我想要匹配的是:
c1.yaf.com/data/groupon/test

期待大大帮忙。

@laruence
Copy link
Owner

那你要看看是不是apache的rewrite没写对啊

@MopLand
Copy link
Author

MopLand commented Mar 11, 2014

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php

是这样设置的。

@MopLand
Copy link
Author

MopLand commented Mar 11, 2014

其他的路由都是好的,就这条不行,感觉像是正则没有匹配一样。

@laruence
Copy link
Owner

PATH_INFO打开了么?

@MopLand
Copy link
Author

MopLand commented Mar 11, 2014

是需要 _SERVER 的 PATH_INFO 变量吗?
我本地的 Apache 确实没有,同事的 Nginx 有,他是正常的,是这个的原因吗?

@MopLand
Copy link
Author

MopLand commented Mar 12, 2014

谢谢大大,已确认是 PATH_INFO 的问题,换个环境就好了。

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