《PHP實例:CodeIgniter針對lighttpd服務器URL重寫的方法》要點:
本文介紹了PHP實例:CodeIgniter針對lighttpd服務器URL重寫的方法,希望對您有用。如果有疑問,可以聯系我們。
本文實例講述了CodeIgniter針對lighttpd服務器URL重寫的辦法.分享給大家供大家參考.具體實現辦法如下:PHP教程
由于開發環境使用的是lighttpd服務器,我本機環境使用的是Apache配置,導致部署到開發機后,所有的鏈接地址全部跳轉到首頁.PHP教程
分析了下,index.php/controller/function ,controller沒有生效,應該是路由分發的緣故.PHP教程
配置lighttpd配置的url重寫規則:PHP教程
url.rewrite-once = ( "/(.*)\.(.*)" => "$0", "/(css|files|img|js|stats)/" => "$0", "^/([^.]+)$" => "/index.php/$1" )
另附Apache url重寫規則:PHP教程
<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!PHP教程
希望本文所述對大家基于CodeIgniter的php程序設計有所贊助.PHP教程
維易PHP培訓學院每天發布《PHP實例:CodeIgniter針對lighttpd服務器URL重寫的方法》等實戰技能,PHP、MYSQL、LINUX、APP、JS,CSS全面培養人才。