简体   繁体   English

由于目录名称相同,未调用codeigniter控制器

[英]codeigniter controller not being called due to directory with same name

I would like to avoid renaming directories or method names if at all possible, this was working on a previous server before being moved to a new hosting. 我想尽可能避免重命名目录或方法名,这是在移至新主机之前在以前的服务器上工作的。

My directory structure is as follows: 我的目录结构如下:

  • /magazine /杂志
  • /site /现场
  • /site/config /站点/配置
  • /site/config/routes.php (routes contains entry: $route["magazine"] = "site/magazine") /site/config/routes.php(路由包含条目:$ route [“ magazine”] =“ site / magazine”)
  • /site/controllers /站点/控制器
  • /site/controllers/site.php (site controller contains method "magazine") /site/controllers/site.php(站点控制器包含方法“ magazine”)
  • /site/models / site / models
  • /site/views / site / views
  • /.htaccess /.htaccess
  • /index.php /index.php

Everything about the site works perfectly until I browse to /magazine, and it tries to go to magazine directory, when I need it to goto the magazine method within the site controller. 在我浏览至/ magazine之前,该网站上的所有内容都可以正常运行,并且在需要它进入站点控制器中的杂志方法时,它会尝试转到杂志目录。

Any help is greatly appreciated. 任何帮助是极大的赞赏。

Thanks! 谢谢! Mike 麦克风

In your htaccess file you probably have something like looks like: 在您的htaccess文件中,您可能看起来像这样:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

Try adding an additional rule for "magazine": 尝试为“杂志”添加其他规则:

RewriteRule ^magazine/?$ index.php/magazine [L]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM