ThinkPHP3二级目录并绑定二级域名

#path /.htaccess
<IfModule mod_rewrite.c>
	Options +FollowSymlinks
	RewriteEngine On
	RewriteBase /

	DirectoryIndex index.html index.php

	RewriteCond %{HTTP_HOST} ^test.xxx.cn$
	RewriteCond %{REQUEST_URI} !^/test/
	RewriteRule ^(.*)$ test/$1
IfModule>
#path /test/.htaccess
<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
  
IfModule>
//path /test/index.php
define('_PHP_FILE_','/index.php');
// 引入ThinkPHP入口文件
require './ThinkPHP/ThinkPHP.php';
//path /test/Application/Common/Conf/config.php
return [
	'URL_MODEL'=>2,
];

如果需要指定默认模块

// /Application/Common/Conf
	'MODULE_ALLOW_LIST'=>['Home','Root'],
	'DEFAULT_MODULE'=>'Home',
 namespace Home\Controller;
class EmptyController extends \Think\Controller{
	function index(){
		$this->redirect('/Index');
	}
}

你可能感兴趣的:(ThinkPHP3.2.5)