简体   繁体   English

seo友好的codeigniter网址

[英]seo friendly url for codeigniter

We have a social networking web site for students. 我们有一个面向学生的社交网站。 Our url looks like this domain.com/student/145236 where 145236 is the roll number. 我们的网址看起来像这个domain.com/student/145236 ,其中145236是转数。 We now have an option of doing something like this domain.com/student/145236/student-name but since google / search engines would prefer domain.com/student-name/student/145236 we would like to do like this, but we are unable to do it, we tried doing this using routes $route['(:any)/student/(:num)'] = 'student/$1'; 现在,我们可以选择执行类似domain.com/student/145236/student-name但是由于google /搜索引擎更喜欢domain.com/student-name/student/145236我们希望这样做,但是我们无法做到这一点,我们尝试使用路由$route['(:any)/student/(:num)'] = 'student/$1'; but it shows 404 page, any help would be grateful :) 但它显示404页面,任何帮助将不胜感激:)

This should be work for you: 这应该为您工作:

$route['(:any)/student/(:num)'] = 'student/yourfunction/$1/$2'; 

Here $1 is for ist param (:any) and $2 is for second param (:num) . $1用于ist参数(:any)$2用于第二参数(:num)

For getting values from the URL inside the student controller you can use CI Segments. 要从学生控制器内部的URL获取值,可以使用CI段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM