php - 从 CodeIgniter 中的 URL 中删除 Controller 名称

标签 php codeigniter controller routes

目前在我的 CI 项目中,我有一个 Controller 来处理所有事情。如注册、登录、激活等。

我的路线是这样工作的……

domain.com/account/login/domain.com/account/register/

如何从路由中删除 account 同时从其他页面中删除 Controller 。

我基本上希望始终移除 Controller 。我这样做的原因之一是 SEO,搜索引擎根据页面在网站中的深度对页面的重要程度进行排名。

我实现这一点的唯一方法似乎是为每个页面做一些类似 route['activate'] = 'account/activate'; 的事情,这将是一个巨大的麻烦。

最佳答案

$route['^(?!other|controllers).*'] = “account/$0″;

关于php - 从 CodeIgniter 中的 URL 中删除 Controller 名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5643535/

相关文章:

php - HTML 输入值变化

php - 创建新的 MVC 文件失败

php - 表格显示已发送,但数据库中没有显示任何数据

php - Codeigniter - session 登录错误

swift - ViewController 类没有初始化器

php - 使用 PHP 将表单数据从一个网页传递到另一个网页

javascript - 从 PHP Controller 类显示警报框

javascript - 如果在特定页面上运行脚本 - rails

model-view-controller - JavaFX 在没有 Controller 的 fxml 中包含 fxml

php - 使用 CodeIgniter ActiveRecord 连接三个表并过滤数据