ci url 是否可能不适用于index.php

2024-05-04

ci url 是否可能无法与index.php 一起使用。我不想在url 中添加index.php。如果有人在url中添加index.php它应该不起作用。我已经尝试了很多方法。请给我建议。 我已经尝试过,但不起作用

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

for e.g

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

`example.com/abc`

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

`example.com/index.php/abc`

在根目录中创建 .htaccess 文件并将此代码保留在其中

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

打开应用程序/config/config.php

    //find the below code   
$config['index_page'] = "index.php" 
//replace with the below code
$config['index_page'] = ""

/find the below code
$config['uri_protocol'] = "AUTO"
//replace with the below code
$config['uri_protocol'] = "REQUEST_URI" 
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ci url 是否可能不适用于index.php 的相关文章

随机推荐