繁体   English   中英

无法从Codeigniter URl中删除index.php

[英]Unable to remove index.php from Codeigniter URl

我无法从我的项目网址中删除index.php。 下面是我尝试过的代码。

在相同的代码和配置设置下面,我的另一个项目在同一服务器上正常运行

在.htaccess文件中

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|imgs)
RewriteRule ^(.*)$ index.php/$1 [L]  
RewriteRule ^media/images/([0-9]+)/([A-Za-z0-9-]+).jpg?$ imgs/$1  [T=image/jpeg,L]
<Files "index.php">
AcceptPathInfo On
</Files>

.htaccess文件与应用程序文件夹平行且位于根文件夹下。

在config.php文件中

$config['uri_protocol'] = 'PATH_INFO';
(also tried same for all server global mentioned in config.php)

and

$config['index_page'] = '';

当前的项目网址类似于http://Hostname/ODP/ (此代码不适用于上面的代码)

以前的项目URL是http://Hostname/WCP/ (此代码适用于上面的代码)

Use following htaccess code to remove index.php from your codeigniter url
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ ./index.php/$1 [L]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM