重定向到特定地址

时间:2015-05-26 08:44:16

标签: php apache .htaccess codeigniter mod-rewrite

我将codeigniter用于我的项目。在localhost我的应用程序没有任何问题。当我把文件放在服务器上时,我认为.htacces有一个大问题。我有一个地址:domain.com/napijmy_sie/index工作,但地址domain.com/napijmy_sie/app不起作用。为什么?我什么都不知道。这是我的.htacces文件:

    <IfModule mod_rewrite.c>
  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 /napijmy_sie
  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 :(得分:1)

试试这个 -

<IfModule mod_rewrite.c>
  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 /napijmy_sie/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ napijmy_sie/index.php?/$1 [L]
</IfModule>

我希望它能起作用。