H, 我使用codeigniter hmvc framework.i不知道如何配置这个fo子域。我已经安装了它,但没有工作。请任何帮助。如何在子域中配置codeigniter hmvc
project/
application/
controller/installer
modules/
默认控制器指向installer.php
$route[default_controller] = 'installer';
,但无法访问控制器。
H, 我使用codeigniter hmvc framework.i不知道如何配置这个fo子域。我已经安装了它,但没有工作。请任何帮助。如何在子域中配置codeigniter hmvc
project/
application/
controller/installer
modules/
默认控制器指向installer.php
$route[default_controller] = 'installer';
,但无法访问控制器。
找到这个文件在这里
的application/config/config.php文件
编辑就是所有
$config['base_url'] = "http://subdomain.example.com/";
不,它是子域或主域名托管问题。你需要做一些事情才能使其可行。
第一步 配置base_url
在config.php如下:
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
第二步检查.htaccess
。它应该看起来像波纹管:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
注:.htaccess
取决于服务器的不同而不同。在某些服务器(例如:Godaddy的)需要使用以下.htaccess
:
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
希望它会帮助你。
感谢您的回应Ariful。但我已经尝试过这些东西。它的工作没有任何本地服务器上的配置。但不在活服务器上的子域中工作。 –
只是尝试以maindomain.com/subdomain格式访问您的子域名,并让我知道发生了什么...... –
对不起。它没有工作,我试过了。 –
已经尝试过,但没有工作。 –
你得到了什么样的错误。@ KenStewart – synan54
它显示空白页。但它在localserver上正常工作。 –