资讯专栏一级栏目地址404错误

2022-02-11 17:08发布

网站环境信息

操作系统Linux / PHP v7.4.27
php应用的web服务器nginx/1.19.8
最大上传大小50M
数据库版本mysql5.6.50-log
allow_url_fopen开始已开启
GD图形库版本bundled (2.1.0 compatible)
最大执行时间300秒
当前服务器时间2022-02-11 17:03:41

Powered by whatsns V6.3.1  ©2022


网站地址:云看家技术分享交流网 https://yunkanjia.com

伪静态规则:

location /{
    if (!-e $request_filename) {
       rewrite  ^(.*)$  /index.php/$1  last;
       break;
    }
}

404地址:https://yunkanjia.com/article/anfang

资讯专栏的所有一级栏目均404

https://yunkanjia.com/article


付费偷看设置
发送
2条回答
懒丶C - 这个人很懒,什么都没留下
1楼 · 2022-02-14 09:45.采纳回答

这个是你自己路由改错了导致的,存在相同路由地址,映射到文章的那个了

作者追问:2022-02-14 09:45

请帮忙看看修改了routes,还需要修改其他地方吗?刷新了缓存部分还是404《木有冲突》

whatsns技术 - whatsns技术经理
2楼-- · 2022-02-14 09:44

这个是你自己修改文章路由规则导致的问题

image.png

文章规则默认article-文章id,你改成了article/文章id,和上面资讯栏目article/栏目id,冲突,导致找不到这个文章id提示404,路由规则自己改下

作者追问:2022-02-17 08:58

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/*
| -------------------------------------------------------------------------
| URI ROUTING
| -------------------------------------------------------------------------
| This file lets you re-map URI requests to specific controller functions.
|
| Typically there is a one-to-one relationship between a URL string
| and its corresponding controller class/method. The segments in a
| URL normally follow this pattern:
|
|    example.com/class/method/id/
|
| In some instances, however, you may want to remap this relationship
| so that a different class/function is called than the one
| corresponding to the URL.
|
| Please see the user guide for complete details:
|
|    https://codeigniter.com/user_guide/general/routing.html
|
| -------------------------------------------------------------------------
| RESERVED ROUTES
| -------------------------------------------------------------------------
|
| There are three reserved routes:
|
|    $route['default_controller'] = 'welcome';
|
| This route indicates which controller class should be loaded if the
| URI contains no data. In the above example, the "welcome" class
| would be loaded.
|
|    $route['404_override'] = 'errors/page_missing';
|
| This route will tell the Router which controller/method to use if those
| provided in the URL cannot be matched to a valid route.
|
|    $route['translate_uri_dashes'] = FALSE;
|
| This is not exactly a route, but allows you to automatically route
| controller and method names that contain dashes. '-' isn't a valid
| class or method name character, so it requires translation.
| When you set this option to TRUE, it will replace ALL dashes in the
| controller and method URI segments.
|
| Examples:    my-controller/index    -> my_controller/index
|        my-controller/my-method    -> my_controller/my_method
*/
$route['default_controller'] = 'index';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['index'] = 'index/index';//对首页重写
//问题库列表重写
$route['ask'] = 'Ask/index';//对问题库列表重写
$route['ask/(:any)'] = 'Ask/index/$1';//对问题库列表重写--分类
$route['ask/(:any)/(:any)'] = 'Ask/index/$1/$2';//对问题库列表重写--分类/排序
$route['ask/(:any)/(:any)/(:num)'] = 'Ask/index/$1/$2/$3';//对问题库列表重写--分类/排序/分页


//文章栏目库列表重写
$route['news'] = 'Seo/index';//对文章栏目库列表重写
$route['news/list/(:any)'] = 'Seo/index/$1';//对文章栏目库列表重写--分类
$route['news/list/(:any)/(:any)'] = 'Seo/index/$1/$2';//对文章栏目库列表重写--分类/排序
$route['news/(:any)/(:any)/(:num)'] = 'Seo/index/$1/$2/$3';//对文章栏目库列表重写--分类/排序/分页


$route['answer/(:num)/(:num)'] = 'Question/answer/$1/$2';//对回答详情页面重写
$route['article/(:any)'] = 'Topic/getone/$1';//对文章重写
$route['article/(:any)/(:num)'] = 'Topic/getone/$1/$2';//对文章重写
$route['cat/(:any)'] = 'Topic/catlist/$1';//对文章分类重写
$route['cat/(:any)/(:num)'] = 'Topic/catlist/$1/$2';//对文章分类重写
$route['q/(:num)'] = 'Question/view/$1';//对问题重写
$route['q/(:num)/(:num)'] = 'Question/view/$1/$2';//对问题重写
$route['u/(:num)'] = 'User/space/$1';//对用户空间重写
$route['u/(:num)/(:num)'] = 'User/space/$1/$2';//对用户空间重写
$route['c/(:any)'] = 'Category/view/$1';//对分类详情url重写
$route['c/(:any)/(:any)'] ='Category/view/$1/$2';//对分类重写
$route['c/(:any)/(:any)/(:num)'] ='Category/view/$1/$2/$3';//对分类重写
$route['ua/(:num)'] = 'User/space_answer/$1';//对用户空间用户回答重写
$route['ua/(:num)/(:num)'] = 'User/space_answer/$1/$2';//对用户空间用户回答重写
$route['ua/(:num)/(:num)/(:num)'] = 'User/space_answer/$1/$2/$2';//对用户空间用户回答重写
$route['uask/(:num)/(:num)'] = 'User/space_ask/$1/$2';//对用户空间用户提问重写
$route['uask/(:num)'] = 'User/space_ask/$1';//对用户空间用户提问重写
$route['ut/(:num)'] = 'Topic/userxinzhi/$1';//对用户空间用户文章url重写
$route['ut/(:num)/(:num)'] = 'Topic/userxinzhi/$1/$2';//对用户空间用户文章url重写
$route['new'] = 'Newpage/index';
$route['new/maketag'] = 'Newpage/maketag';
$route['new/default'] = 'Newpage/index';
$route['appstore/default'] = 'Appstore/index';
$route['new/default/(:num)'] = 'Newpage/index/$1';
$route['new/default/(:num)/(:num)'] = 'Newpage/index/$1/$2';
$route['new/question/(:num)/(:num)'] = 'Newpage/catname/$1/$2';
$route['new/question/(:num)/(:num)/(:num)'] = 'Newpage/catname/$1/$2/$3';

$route['new/(:num)'] = 'Newpage/index/$1';
$route['new/(:num)-(:num)'] = 'Newpage/index/$1/$2';
$route['note/list'] = 'Note/clist';
$route['note/list/(:num)'] = 'Note/clist/$1';//公告分页
$route['rss/list'] = 'Rss/clist';
$route['Api_article/list'] = 'Api_article/clist';
$route['pccaiji_catgory/list'] = 'Pccaiji_catgory/clist';
$route['tag/(:any)'] = 'Tags/view/$1';
$route['tag/(:any)/(:any)'] = 'Tags/view/$1/$2';
$route['content/(:any)'] = 'Content/index/$1';
$route['content/(:any)/(:any)'] = 'Content/index/$1/$2';
$route['attention/(:any)'] = 'User/attention/$1';
$route['attention/(:any)/(:any)'] = 'User/attention/$1/$2';

routes文件代码如上,我还需要修改其他地方吗?

现在是

文章栏目库列表重写
$route['news'] = 'Seo/index';//对文章栏目库列表重写
$route['news/list/(:any)'] = 'Seo/index/$1';//对文章栏目库列表重写--分类
$route['news/list/(:any)/(:any)'] = 'Seo/index/$1/$2';//对文章栏目库列表重写--分类/排序
$route['news/(:any)/(:any)/(:num)'] = 'Seo/index/$1/$2/$3';//对文章栏目库列表重写--分类/排序/分页

这部分都是404~谢谢~

一周热门 更多>