我在 maindomain
下有一个 Subdomain
。我想在 subdomain
下安装 CodeIgniter
。但是 subdomain
不适用于 CodeIgniter
默认 route
。
比如我的 子域
是 demo.example.com
不工作。通常 core php
正在为这个 subdomain
工作,但 CodeIgniter
不是。
但是当我调用 demo.example.com/welcome
然后工作。这里的 welcome
是一个 Controller
名称。
谁能帮我看看我哪里错了?
我的基本 URL 是:
$config['base_url'] = 'http://demo.example.com';
我的 .htaccess 是
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
我的默认 Controller (welcome.php
)是
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
echo 'Welcome Subdomain';
}
}
最佳答案
您的 Controller 名称是 Welcome.php
作为 public_html/demo/application/controllers/Welcome.php
。
请将 Welcome.php
改为 welcome.php
在 routes.php< 中将
$route['default_controller'] = "Welcome"
设置为 $route['default_controller'] = "welcome"
/
关于php - 子域不适用于 CodeIgniter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40541233/