codeigniter,路由没有生产服务器上运行路由、器上、codeigniter

2023-09-02 00:51:37 作者:不薈彈琹的詩仒

我有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]