codeigniter,路由没有生产服务器上运行 [英] Codeigniter, routing is not functioning on production server

查看:110
本文介绍了codeigniter,路由没有生产服务器上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3台服务器,本地主机的Apache服务器,测试远程服务器和生产活的服务器。

I have 3 servers, a localhost apache server, a testing remote server and the production live server.

我有同样安装codeigniter,并在所有3人,并在本地主机站点设置和测试服务器的路由不'的index.php'工程100%。在生产服务器上但是,不管是什么网址说,只有网页(通过默认控制器)将显示,似乎所有的路由规则被忽视,除了默认的。

I have the same installation of codeigniter and site set-up on all 3 of them and on the localhost and testing servers routing without 'index.php' works 100%. On the Production server however, no matter what the URL says only the homepage (via the default controller) will be shown, it seems all routing rules are being ignored except the default one.

然而,如果是的index.php在URL中添加那么它会像它应该。

If however index.php is added in the URL then it will work like it supposed to.

例如,如果对生产现场的网址是:'www.mysite.com/information,然后加载内容构成了默认控制器。

For instance if the URL on the production site is: 'www.mysite.com/information' then the content that loads is form the default controller.

但是,当对生产现场的网址是:'www.mysite.com/index.php/information,然后加载的内容是从信息控制器。

But when the URL on the production site is: 'www.mysite.com/index.php/information' then the content that loads is from the 'information' controller.

这是我的htacess文件的内容: http://pastebin.com/cDaZVJ8A

This is the contents of my htacess file: http://pastebin.com/cDaZVJ8A

这是我的路由配置文件: http://pastebin.com/7Ewc2bwN

This is my routes config file: http://pastebin.com/7Ewc2bwN

我的$配置['index_page']设置为无。

My $config['index_page'] is set to nothing.

我真的不知道为什么它不工作,同样在codeigniter本身,而mod_rewrite的期限设置中的所有服务器上的工作在生产服务器上。

I really dont know why its not working, the same setup on all servers in term of codeigniter itself, and mod_rewrite IS working on the production server.

我不知道该怎么办,我怎么能找到,出了什么问题?

I don't know what to do, how can I find-out what's wrong?

推荐答案

这是经常发生,当人们移动codeigniter安装从一个环境到另一个相当普遍的问题。我不知道为什么会发生,可能是服务器操作系统或Apache设置有区别的,但解决方案通常是一个问号添加到重写规则的索引。 PHP的在你的.htaccess文件。

This is quite a common problem that often occurs when people move a codeigniter install from one environment to another. I have no idea why it occurs, could be a difference in server OS or apache settings, but the solution is often to add a question mark ? to the RewriteRule for the index.php in your .htaccess file.

旧:

RewriteRule ^(.*)$ index.php/$1 [L]

新:

RewriteRule ^(.*)$ index.php?/$1 [L]

这篇关于codeigniter,路由没有生产服务器上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆