Files
YwxAppThink/addon/seo/route/app.php
T

39 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// +----------------------------------------------------------------------
// | YwxApp [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
// +----------------------------------------------------------------------
// +----------------------------------------------------------------------
// | Author: ywxapp<admin@ywxapp.cn>
// +----------------------------------------------------------------------
use think\facade\Route;
// 说明:本文件由 ywxapp/service/AppService::loadAddonRoutes() 在 boot 阶段
// include,并统一被外层 Route::group('seo', ...) 包住,因此下面写的都是
// 【相对规则】,最终自动加 /seo 前缀:
// 顶层规则 -> /seo/*
// backend 组 -> /seo/backend/*
// api 组 -> /seo/api/*
// 前台页面 / 接口(最终地址 /seo/index、/seo/sitemap.xml、/seo/robots.txt
Route::rule('index', 'Index/index');
Route::rule('sitemap.xml', 'Index/sitemap')->completeMatch(true);
Route::rule('robots.txt', 'Index/robots')->completeMatch(true);
// 后台管理路由(对应 controller/backend/ 下的控制器;最终地址 /seo/backend/*
// 注意:全局 route_complete_match=false 时,裸规则会前缀匹配子路径,故必须
// ->completeMatch(true) 强制完整匹配,避免 /seo/backend/setting 被派发到错误动作。
Route::group('backend', function () {
Route::rule('index', 'backend/Seo/index')->completeMatch(true);
Route::rule('setting', 'backend/Seo/setting')->completeMatch(true);
Route::rule('keywords', 'backend/Seo/keywords')->completeMatch(true);
Route::rule('stats', 'backend/Seo/stats')->completeMatch(true);
});
// 对外 API(最终地址 /seo/api/*,按需启用)
Route::group('api', function () {
Route::rule('lists', 'api/Seo/lists')->completeMatch(true);
});