有没有可能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]
例如,用于
如果我使用下面的url,这应该是有效的.............
`example.com/abc`
如果我使用下面的链接,url不会起作用
`example.com/index.php/abc`
发布于 2018-08-18 14:48:04
在index.php的顶部添加以下代码。我想这会解决你的问题。
if(strpos($_SERVER['REQUEST_URI'],'index.php') !== false){
header('location: http://xyx.com/404');
die();
}
发布于 2018-08-03 13:23:04
在根目录中创建.htaccess文件,并将以下代码保存在该文件中
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
打开application/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"
发布于 2018-08-19 00:39:18
您可以使用:
RewriteEngine On
# 403 Forbidden for index.php
RewriteCond %{THE_REQUEST} index\.php [NC]
RewriteRule ^ - [F]
# Rewrite to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
https://stackoverflow.com/questions/51665022
复制相似问题