A codeigniter网站(让我们把它叫做 WEBA )被安装在sebserver/的根源,从域访问:www.example.com
A Codeigniter Website (Lets call it WebA) is installed on the root of the sebserver "/", accessed from the domain: www.example.com.
另外codeigniter网站(让我们把它叫做韦伯)安装在相同的网络服务器中的子文件夹/子文件夹,从域访问:www.example2.com
Another Codeigniter Website (Lets call it WebB) is installed in the same webserver in a subfolder "/subfolder", accessed from the domain: www.example2.com.
我有删除的index.php,安装在WEBA和韦伯2 .htacces文件:
I have 2 .htacces files that remove the index.php, installed on WebA and in WebB:
<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]
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} (auth|register|secure)
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} !(static|auth|register|secure)
RewriteRule ^(.*)$ http://%{SERVER_NAME}%{REQUEST_URI} [R=301]
</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>
AddType application/vnd.ms-fontobject .eot
AddType application/octet-stream .otf .ttf
我已在WEBA在/application/config/config.php配置:
I have configured on WebA in /application/config/config.php:
$config['base_url'] = 'http://example.com/';
而在韦伯在/subfolder/application/config/config.php:
And in WebB in /subfolder/application/config/config.php:
$config['base_url'] = 'http://example2.com/';
错误1:
使用,当我访问www.example2.com这个配置我得到:
Error 1:
With This configuration when I access www.example2.com I get:
404找不到页面
如果我改变韦伯的的.htaccess的RewriteBase行:
If I change WebB's .htaccess RewriteBase line to:
RewriteBase /subfolder/
我得到的HTML输出,在索引http://example2.com/,但它不会加载任何我的JS和CSS,而不是加载脚本,因为它加载的:
I get the html outputted, in the index "http://example2.com/" but it will not load any of my JS or CSS, because instead of loading the script it loads this:
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Trying to get property of non-object</p>
<p>Filename: controllers/html.php</p>
<p>Line Number: 60</p>
</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">
<h4>A PHP Error was encountered</h4>
<p>Severity: Warning</p>
<p>Message: Cannot modify header information - headers already sent by (output started at /var/www/subfolder/system/core/Exceptions.php:185)</p>
<p>Filename: helpers/url_helper.php</p>
<p>Line Number: 546</p>
</div>
这还输出试图浏览页面时,这个错误,但我没有得到任何HTML。
It also outputs this error when trying to navigate the pages but I get no Html.
第一个错误似乎是因为我的数据库模型不能正常工作的missconfiguration的是。
The first error seems to be because of the missconfiguration my database models are not working.
如果我改变韦伯的config.php文件到:
If I change WebB's config.php to:
$config['base_url'] = 'http://example.com/subfolder/';
和在.htaccess韦伯的的RewriteBase行:
And WebB's RewriteBase line in .htaccess to:
RewriteBase /subfolder/
它的做工精细,当www.example.com/subfolder/和www.example2.com,但问题访问是韦伯的联系,这是我需要他们的www.example2.com,而不是www.example .COM /子文件夹/
Its working fine, when accessed by www.example.com/subfolder/ and www.example2.com, but the problem are the WebB's links, which I need them to be as www.example2.com and not www.example.com/subfolder/
WEBA始终工作。
我有同样的code工作在多个网站上没有任何问题,但在此之前我从来没有遇到这种情况。任何想法?
I have the same code working on multiple websites without any problems, but I have never faced this scenario before. Any ideas?
推荐答案
好了,我终于得到了这个工作,我所做的:
Ok, so I finally got this working, what I did:
我问我的系统管理员更改所有的网站使用Virtualhosts作为希沙姆LEMGHARI 的sugested,但我不知道他这样做是正确的,因为我仍然有错误,对韦伯:
I asked my system administrator to change all the websites to use Virtualhosts as Hicham LEMGHARI sugested, but I dont know if he did it right because I still had the errors on WebB:
WEBA安装在/ var / WWW / subfolderA
WebA installed in /var/www/subfolderA
韦伯安装在/ var / WWW / subfolderB
WebB installed in /var/www/subfolderB
WEBA的配置htaccess文件的RewriteBase行:
WebA's htaccess file configured RewriteBase line as:
RewriteBase /subfolderA/
和config.php文件:
And config.php:
$config['base_url'] = 'http://example.com/';
韦伯
韦伯的htacces文件彻底改变,只是这4行:
WebB
WebB's htacces file changed completely to just these 4 lines:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
和config.php文件到:
And config.php to:
$config['base_url'] = 'http://example2.com/';
相关推荐
最新文章