laravel无法正确路由,开启Apache mod_rewrite模块

来源:互联网 发布:c语言体会 编辑:程序博客网 时间:2024/06/05 09:59

具体情况:

routes.php中Route::controller('/' , 'testController');TestController.php中public function getIndex(){    $value = Config::get('app.timezone');    echo $value;}这里是控制器路由,也就是说分别在访问http://localhost:1000http://localhost:1000/index时 都应该显示TestController中的getIndex方法但实际访问时,却无法访问http://localhost:1000/abort会出现错误 如下Not FoundThe requested URL /abort was not found on this server.Apache/2.4.9 (Win32) PHP/5.5.12 Server at localhost Port 1000这是用apache做服务器时发生的情况如果用php内置服务器 则没有出现类似的问题

解决方案:

在apache的http.config中把LoadModule rewrite_module modules/mod_rewrite.so前面的*去掉这里的意思是开启Apache mod_rewrite模块作用是通过http://localhost:8080/php/访问时,/php/和其下面的子目录将支持url rewrite。Rewirte主要的功能就是实现URL的跳转和隐藏真实地址,基于Perl语言的正则表达式规范。平时帮助我们实现拟静态,拟目录,域名跳转,防止盗链等

参考资料:

http://wenda.golaravel.com/question/993http://www.php100.com/html/webkaifa/apache/2010/0228/4006.htmlhttp://bbs.php100.com/simple/?t300372.html
0 0
原创粉丝点击