【问题标题】:.htaccess with codeigniter redirecting.htaccess 与 codeigniter 重定向
【发布时间】:2013-06-16 13:26:08
【问题描述】:

我正在使用 codeigniter 来实现这一点

test.html redirect to 

index.php/test/test

第一个测试是文件夹名称

&第二个测试是控制器

【问题讨论】:

  • 不要将.htaccess 用于框架默认为您提供的(routing)

标签: php codeigniter .htaccess redirect


【解决方案1】:

对于 test.html,你可以这样做你 .htaccess

RewriteEngine On
RewriteBase /
RewriteRule ^test.html$ index.php/test/test [L]

或者在routes.php中你也可以定义一个路由

$route['test.html'] = 'index.php/test/test';

【讨论】:

  • 接受您的建议,我删除 .htaccess 并从路由 $route['test.html'] = 'index.php/test/test';但它重定向到 404 .. 顺便说一下我使用 CI 控制器...
  • @JaffarRaza 不要删除完整的 .htaccess 文件,只需删除这些行,然后添加 routes.php
猜你喜欢
  • 1970-01-01
  • 2023-03-20
  • 1970-01-01
  • 2013-07-02
  • 2013-05-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-16
  • 2016-07-02
相关资源
最近更新 更多