首页 > 其他 > 详细

配置二级域名

时间:2019-12-19 14:23:48      阅读:76      评论:0      收藏:0      [点我收藏+]

1.配置虚拟域名,打开apache/conf/extra/httpd-vhosts.conf文件

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host2.example.com
    DocumentRoot "F:\PHP\test\Multi-store-mall-ThinkPHP5.1\think\public"
    ServerName mall.msm.cn  #域名
    ServerAlias malladmin.msm.cn    #域名别名(配合TP5.1配置二级域名)
    ErrorLog "logs/mall.msm.cn-error.log"
    CustomLog "logs/mall.msm.cn-access.log" common
</VirtualHost>

2.配置本地hosts文件

127.0.0.1    mall.msm.cn
127.0.0.1    malladmin.msm.cn

3.apache开启rewrite模块,更改TP5.1/public下的伪静态文件,隐藏入口文件index.php

<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?s=$1 [QSA,PT,L]
</IfModule>

4.TP5.1开启二级域名,更改route/route.php文件

use think\facade\Route;

//配置tp5.1二级域名
Route::domain('mall', 'index');    mall.msm.cn指向index模块
Route::domain('malladmin', 'admin');    malladmin.msm.cn指向admin模块

配置二级域名

原文:https://www.cnblogs.com/daijiandong/p/12067344.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!