【发布时间】:2012-08-07 01:15:07
【问题描述】:
当用户在 URL 中键入 index.php 时,我需要显示 404 页面:
http://localhost:8080/site_name/index.php/home
我在 routes.php 中添加了这个 $route['index.php/(:any)'] = 'custom404';
这没有帮助;当用户键入http://localhost:8080/site_name/index.php/home 主页时出现而不是 404 not found。
知道当用户在 URL 中键入 index.php 时如何显示 404 页面吗?
我的 htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /site_name/index.php/$1 [L]
【问题讨论】:
-
您希望所有链接都转到 custom404 吗?
-
仅当 index.php 存在时
标签: php codeigniter