由于开发环境使用的是lighttpd服务器,我本机环境使用的是apache配置,导致部署到开发机后,所有的链接地址全部跳转到首页。
分析了下,index.php/controller/function ,controller没有生效,应该是路由分发的缘故。
配置lighttpd配置的url重写规则:
|
1 2 立即学习“PHP免费学习笔记(深入)”; 3 4 5 |
url.rewrite-once = ( "/(.*)\.(.*)" => "$0", "/(css|files|img|js|stats)/" => "$0", "^/([^.]+)$" => "/index.php/$1" ) |
另附Apache url重写规则:
|
1 2 立即学习“PHP免费学习笔记(深入)”; 3 4 5 6 7 8 9 10 11 12 |
ProxyPreserveHost On DocumentRoot "D:/Program Files/xampp/htdocs/xxx" ServerName xxx.baidu.com DirectoryIndex index.php Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all |
重启lighttpd服务,ok!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号