当前位置: 移动技术网 > IT编程>开发语言>PHP > CodeIgniter针对lighttpd服务器URL重写的方法

CodeIgniter针对lighttpd服务器URL重写的方法

2019年05月24日  | 移动技术网IT编程  | 我要评论

本文实例讲述了codeigniter针对lighttpd服务器url重写的方法。分享给大家供大家参考。具体实现方法如下:

由于开发环境使用的是lighttpd服务器,我本机环境使用的是apache配置,导致部署到开发机后,所有的链接地址全部跳转到首页。

分析了下,index.php/controller/function ,controller没有生效,应该是路由分发的缘故。

配置lighttpd配置的url重写规则:

url.rewrite-once = (
 "/(.*)\.(.*)" => "$0",
 "/(css|files|img|js|stats)/" => "$0",
 "^/([^.]+)$" => "/index.php/$1"
)

另附apache url重写规则:

<virtualhost *:80> 
  proxypreservehost on 
  documentroot "d:/program files/xampp/htdocs/xxx" 
  servername xxx.baidu.com 
  directoryindex index.php 
  <directory "d:/program files/xampp/htdocs/xxx">  
    options indexes followsymlinks
    allowoverride all
    order allow,deny
    allow from all
  </directory>
</virtualhost>

重启lighttpd服务,ok!

希望本文所述对大家基于codeigniter的php程序设计有所帮助。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网