2 codeigniter应用和放大器; htaccess的 [英] 2 codeigniter applications & htaccess

查看:153
本文介绍了2 codeigniter应用和放大器; htaccess的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个codeigniter proyect在Windows与XAMPP工作,现在我将它移动到我的RaspberryPi:

I had a codeigniter proyect working in windows with XAMPP and now I was moving it to my RaspberryPi:

  1. 的Apache / 2.2.22(Debian的)
  2. 在PHP 5.4.4-14 + deb7u5
  3. MySQL的版本14.14 DISTRIB 31年5月5日

我有两个codeignitir aplications(本金和面板)本estructure

I have two codeignitir aplications (principal and panel) with this estructure

/ -> (apache root folder)
/appname/admin 
        /admin/application/ -> (codeigniter application to panel)
/appname/application/ -> (codeigniter application to public)

现在我不能访问管理控制器,我想是因为的.htaccess。我得到这个在某些网址: my.domain /应用程序的名字 - > codeigniter欢迎公众(这部分是空的,所以我觉得是O​​K) my.domain /应用程序的名字/管理/ login.html的 - >未找到。所请求的URL / MYDOMAIN /管理/登入在此服务器上找到。 ?my.domain /应用程序的名字/管理/ index.php文件控制器=管理 - > 404找不到网页(codeigniter风格) my.domain /应用程序的名字/管理/ hello.html的 - >你好(一个虚拟文件我把去尝试,工程确定)

Now I can't access to admin controllers and I think is because .htaccess. I get this in some url: my.domain/appname -> codeigniter welcome for public (this part is empty so I think is OK) my.domain/appname/admin/login.html -> Not Found. The requested URL /mydomain/admin/login was not found on this server. my.domain/appname/admin/index.php?controller=admin -> 404 Page Not Found (codeigniter style) my.domain/appname/admin/hello.html -> hello (a dummy file I put to try, works ok)

在我的codeigniter面板proyect我有

In my codeigniter panel proyect I have

$config['base_url'] = 'http://my.domain/myapp/admin/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
$config['url_suffix'] = '.html';

我觉得它的所有有关的.htaccess,但我不理解他们。我多少个文件需要什么?什么文件夹?

I think it's all about .htaccess but I don't understand them. How many files I need? What folders?

我有这个的.htaccess在我/应用程序的名字和放大器; /应用程序的名字/面板之前

I had this .htaccess in my /appname & /appname/panel before

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /appname #to panel /appname/panel

#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]

#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
#This last condition enables access to the images and css folders, and the robots.txt file
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule .* index.php/$0 [PT,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.

ErrorDocument 404 /index.php
</IfModule>

我觉得RewriteEngine叙述在我的Apache2被激活。

I think RewriteEngine on is activated in my apache2.

推荐答案

我发现溶液的.htaccess内管理的文件夹:

I found solution by .htaccess inside admin's folder:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /appname/admin

    #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 'appname' to your applications folder name.
    RewriteCond %{REQUEST_URI} ^appname.*
    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>

<一个href="http://stackoverflow.com/questions/11135711/$c$cigniter-multiple-applications-htaccess">$c$cIgniter多个应用程序的htaccess

这篇关于2 codeigniter应用和放大器; htaccess的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆