Codeigntier:默认路由不是呼叫" en"路线

时间:2016-06-28 08:22:33

标签: .htaccess codeigniter routes

我正在研究CI项目,我正在呼叫" en"默认控制器之前的路由。但是我似乎无法提供论证 它起作用:
http://193.42.156.121/airport/en

但我试图让它工作,即使: http://193.42.156.121/airport

我的路由配置在本地服务器上工作正常但在基于Linux的在线服务器上不能正常工作 这是路由配置:

RewriteEngine On
RewriteCond $1 !^(index\.php|styles|scripts|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

或者.htaccess文件是否有任何问题?我无法弄明白这是我的.htaccess文件:

@RunWith(Cucumber.class)
@CucumberOptions(features = "src/test/resorces")
public class CucumberTest {
}

请帮帮忙,如果需要其他任何事情请问我。

2 个答案:

答案 0 :(得分:0)

<IfModule mod_rewrite.c>
AddDefaultCharset UTF-8
  RewriteEngine On
  # !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
  #  slashes.
  # If your page resides at
  #  http://www.example.com/mypage/test1
  # then use
  # RewriteBase /mypage/test1/
  RewriteBase /mypage/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
  # If we don't have mod_rewrite installed, all 404's
  # can be sent to index.php, and everything works as normal.
  # Submitted by: ElliotHaughin

  ErrorDocument 404 /index.php
</IfModule>

答案 1 :(得分:0)

有时事情变得非常令人毛骨悚然,经过几个小时的花时间查看源页面,我看到文档的头部有一个换行符。并且通过删除根目录中存在的 index.php 中的空行1来显示一些警告,使其正常工作。