Seo optimization, Laravel, yii2, restfull. There are several questions in this post, please have a friend of this kind of knowledge

140 3

For seo optimization, I think the url shouldn't have some module name, controller name. The slug of the article should only appear.

My own novel is that it's designed.
Information ://www. X. Com/gulong.
Details of http://www. X. Com/xiaolifeidao.
://www. X. Com/youxiuzhuojiapaiming this is a forum section"superior show"ranking.

I'll have a system slug.
According to the slug table, this article belongs to the news module or the novel.

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, I used Laravel for this novel. It's easy to write. If it's to yii2, do you write it? ( the next project is larger and longer, and the path is determined by yii2, the path of yii2 isn't as flexible as it's. )
2, this pattern to optimize seo is a problem.
3, I saw someone on the foreign stackflow. It's a good answer. It's better to use restfull to handle this design, I don't understand. How do you use restfull to achieve such an idea.

1 Answers

123 4

You're certainly not too big for this writing, and the url path is shorter, but the directory structure isn't clear. In order to do seo, there's no dynamic url, that's the question of the question mark. A restful style is a better way to handle this, and don't use complex paths.

For example, this should be a type, and the url should be: 作者古龙的信息 小说《小李飞刀》的具体内容。 这是一个论坛的版块《优秀作家排名》

But it's strange to use pinyin directly, because it's a dynamic growing data, so generally id numbers, as an example of a novel:
http://www. X. Com/novel/1.
A corresponding novelcontroller has a url for/novel/% 7bid % referrals, and id can be accessed dynamically based on urls.

This design has a clear classification, and the hierarchy isn't too much, people look easy and easy to understand, so natural weight will be higher.