Php 使用Codeigniter重写类似facebook配置文件的URL

Php 使用Codeigniter重写类似facebook配置文件的URL,php,.htaccess,codeigniter,mod-rewrite,Php,.htaccess,Codeigniter,Mod Rewrite,我在controller profile.php中有一个带有参数user_id的索引函数,我很难在htaccess中重写我的url。www.domainname/profile/(user_id)转换为www/domainname/username 我将非常感谢您的答复。谢谢:)您可以在CI中使用路由。您可以按照Nish所说的使用路由,但您需要更改配置文件方法以将用户名作为输入(而不是用户id)。因此,您的查询也需要更改。

我在controller profile.php中有一个带有参数user_id的索引函数,我很难在htaccess中重写我的url。www.domainname/profile/(user_id)转换为www/domainname/username


我将非常感谢您的答复。谢谢:)

您可以在CI中使用路由。您可以按照Nish所说的使用路由,但您需要更改配置文件方法以将用户名作为输入(而不是用户id)。因此,您的查询也需要更改。