"未指定输入文件。"在双应用程序编码器中

时间:2014-05-20 10:50:36

标签: php .htaccess codeigniter

我做了广泛的搜索,但无法找到解决问题的方法。

我使用codeigniter和两个应用程序 - 一个用于前端,一个用于后端。

我的文件夹树就像:

  • 应用
    • 后端
    • 前端
  • 系统
  • 的index.php
  • admin.php的

我写了htaccess文件:

RewriteEngine on

RewriteCond $1 !^(index\.php|images|table-images|js|robots\.txt|css)

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

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

我想删除" index.php"来自网址但是" admin.php"可以留下来,没问题。它在前端工作正常,但是当我访问/admin.php/login时,它会返回"没有指定输入文件。"

在Godaddy托管中我对此htaccess没有任何问题,但现在我必须使用另一家托管公司。

你能帮帮我吗?非常感谢

2 个答案:

答案 0 :(得分:0)

我发现最好的方法是复制应用程序文件夹和index.php文件并在名为backend的目录中创建一个新文件夹你可能需要做一些调整。

应用程序文件夹 的index.php "后端"夹 "后端/应用程序 " backend / index.php

同时添加到配置基本网址" BASE" $ config [' base_url'] = BASE_URL;

我把主要的index.php也复制并粘贴到后端index.php

/*
 *--------------------------------------------------------------------------
 * Base URL
 *--------------------------------------------------------------------------
 *
 * Attemtps to figure the root web address
 *
 */
if (isset($_SERVER['HTTP_HOST']))
{
$base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ? 'https' : 'http';
$base_url .= '://'. $_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
}   
else
{
$base_url = 'http://localhost/';
}

define('BASE_URL', $base_url);

unset($base_url);

答案 1 :(得分:0)

尝试使用此htaccess并访问此页面http://philsturgeon.co.uk/blog/2009/06/How-to-Multi-site-CodeIgniter-Set-uphttp://philsturgeon.co.uk/blog/2009/07/Create-an-Admin-panel-with-CodeIgniter

Options +FollowSymLinks
Options -Indexes
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    #Removes access to the system folder by users.
    #Additionally this will allow you to create a System.php controller,
    #previously this would not have been possible.
    #'system' can be replaced if you have renamed your system folder.
    RewriteCond %{REQUEST_URI} ^system.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #When your application folder isn't in the system folder
    #This snippet prevents user access to the application folder
    #Submitted by: Fabdrol
    #Rename 'application' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^application.*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    #Checks to see if the user is attempting to access a valid file,
    #such as an image or css document, if this isn't true it sends the
    #request to index.php
    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>