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

这篇文章主要介绍了CodeIgniter针对lighttpd服务器URL重写的方法,涉及lighttpd服务器配置及URL配置规则的相关技巧,需要的朋友可以参考下

本文实例讲述了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重写规则:

  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!

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

以上就是CodeIgniter针对lighttpd服务器URL重写的方法的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » PHP编程