【问题标题】:Codeigniter rewriting URLs replace question marks with slashesCodeigniter 重写 URL 用斜杠替换问号
【发布时间】:2017-03-28 04:46:11
【问题描述】:

我正在使用 PHP Codigniter 开发一个网站, 我想让我的网址看起来更好, 例如我想要这个网址:

http://localhost/mlotfy/freelancing/quiz/view_quiz?id=25

看起来像这样:

http://localhost/mlotfy/freelancing/quiz/25

我已经在 .htaccess 文件中尝试过这个重写规则,但没有成功(找不到 404 页面)

RewriteRule quiz/([0-9]+)    quiz/view_quiz?id=([0-9]+)

【问题讨论】:

  • 如果有帮助请告诉我。
  • 您可以使用 CI 路由代替 .htaccess。

标签: php codeigniter url-rewriting


【解决方案1】:

试试这个

RewriteRule ^quiz/([0-9]+)/?$ quiz/view_quiz?id=$1 [NC,QSA,L]

【讨论】:

    猜你喜欢
    • 2017-05-17
    • 1970-01-01
    • 2015-03-26
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 2021-04-27
    • 1970-01-01
    相关资源
    最近更新 更多