In order to optimize SEO, I think the URL should not be out of some module Name,controller name. Only the slug of the article should appear.
My own fiction stand is this design.
Http://www.x.com/gulong the author of Cologne's information
The concrete contents of Http://www.x.com/xiaolifeidao novel "Xiao Li Fei dao".
Http://www.x.com/youxiuzhuojiapaiming This is a forum section "excellent writer rankings"
I'll have a system_slug table.
According to the slug table to find out whether this article belongs to the news module, or belongs to the novel module.
SystemController { public funciton distributionController($slug) { $module = "select moduleName from system_slugs where slug='slug'; $contoller = "select contollerName from system_slugs where slug='slug'; return $module::$contollerName($slug); }}
1, my novel station is Laravel, very convenient to write. If you change to Yii2, does this make sense, (the next project is bigger and longer, and has resolved to use the YII2,YII2 route assignment as if it's not flexible enough?) )
2, this mode to optimize SEO there is no problem ah?
3, I saw some people mentioning this problem in the foreign stackflow. Someone replied that it is better to use restfull to deal with such design, I do not understand. How is it more beneficial to realize such an idea with restfull?
Reply content:
In order to optimize SEO, I think the URL should not be out of some module Name,controller name. Only the slug of the article should appear.
My own fiction stand is this design.
Http://www.x.com/gulong the author of Cologne's information
The concrete contents of Http://www.x.com/xiaolifeidao novel "Xiao Li Fei dao".
Http://www.x.com/youxiuzhuojiapaiming This is a forum section "excellent writer rankings"
I'll have a system_slug table.
According to the slug table to find out whether this article belongs to the news module, or belongs to the novel module.
SystemController { public funciton distributionController($slug) { $module = "select moduleName from system_slugs where slug='slug'; $contoller = "select contollerName from system_slugs where slug='slug'; return $module::$contollerName($slug); }}
1, my novel station is Laravel, very convenient to write. If you change to Yii2, does this make sense, (the next project is bigger and longer, and has resolved to use the YII2,YII2 route assignment as if it's not flexible enough?) )
2, this mode to optimize SEO there is no problem ah?
3, I saw some people mentioning this problem in the foreign stackflow. Someone replied that it is better to use restfull to deal with such design, I do not understand. How is it more beneficial to realize such an idea with restfull?
Of course, you are not too much of a problem, URL path will be relatively short, but the directory structure level is not clear. In order to do SEO focus is not a dynamic URL, that is, with the question mark of the kind. RESTful style is better to handle this situation, and do not have to go with complex routing.
For example, in your case, these should all belong to a certain type, then the URL should be:
http://www.x.com/author/gulong 作者古龙的信息
http://www.x.com/novel/xiaolifeidao 小说《小李飞刀》的具体内容。
http://www.x.com/board/youxiuzhuojiapaiming 这是一个论坛的版块《优秀作家排名》
But the above directly with Pinyin is very strange, because this is a dynamic growth of data, so generally is the ID number, the novel as an example:
http://www.x.com/novel/1
The corresponding Novelcontroller has a "/novel/{id}" url to correspond, the ID is dynamically retrieved according to the URL.
Such a design has a clear classification, the directory hierarchy is not too much, people look easy to understand, crawlers are easy to understand, so the natural weight will be a little higher.