和symfony一样,在godaddy的主机上,ci的路由也会出现问题,修改方法如下
原文地址: http://codeigniter.com/wiki/Godaddy_Installaton_Tips/
Thank you to everyone who’s posted on Godaddy installation issues.
Having just struggled with this issue myself, this seems to be the shortest path to proper performance on Godaddy. This is entirely based on other people’s posts but, I didn’t really see this all in one place so I thought I do just that.
In config.php:
$config['index_page'] = "index.php?";
$config['uri_protocol'] = "QUERY_STRING"; I’ve successfully implemented this on GoDaddy without using “index.php?” as the index page. This is helpful when using anchor() in the URL helper to create links. Even with htaccess removing the index.php, anchor() will still put in what you have set as an index page.
You should now be able to access everything as such:
http://yourdomain.com/index.php?controller/action/etc Once you get to a point where you want to hide the ‘index.php?’ paste this into your .htaccess file:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?$1 [L] You should now be able to access everything as such:
http://yourdomain.com/controller/action/etc The .htaccess file must be in Unix LF only style. If you use Notepad or Wordpad and upload an .htaccess file in CR/LF style it won’t work.
Hope this is helpful.
在一些主机上,比如godaddy,php是以cgi模式运行,这时服务器的path_info变量会出现问题,导致symfony的路由获取的信息不对,在访问
index.php/app/action这样的链接时出现错误。
这时可以修改setting.yml文件加入
path_info_key: REDIRECT_URL
并修改php.ini,加入
cgi.fix_pathinfo = 1
doc_root=
即可

Recent Comments