ci url是否可能不适用于index.php [英] Is it possible that ci url will not work with index.php

查看:37
本文介绍了ci url是否可能不适用于index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ci url是否可能不适用于index.php.我不想在url中添加index.php.如果有人在URL中添加index.php,它应该不起作用.我尝试了许多方法.请给我建议.我已经尝试过了,但是没有用

Is it possible that ci url will not work with index.php.I dont want to add index.php in url. If someone adds index.php in url it should not work.I have tried many methods . Please give me suggestion. I have tried but it's not working

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

例如

如果我使用下面的网址,这应该可以..............

if i use below url This should work..............

`example.com/abc`

如果我在下面的网址中使用应该不起作用

if i use below url shouldn't work

`example.com/index.php/abc`

推荐答案

在index.php顶部添加以下代码.我认为这可以解决您的问题.

Add below code in the top of the index.php. I think this will solve your problem.

if(strpos($_SERVER['REQUEST_URI'],'index.php') !== false){
    header('location: http://xyx.com/404');
    die();
}

这篇关于ci url是否可能不适用于index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆