dongwupu5991 2013-08-05 08:07
浏览 66

无法从Codeigniter URl中删除index.php

I am unable to remove index.php from my project Url. Below is the code i had try for that.

Below same code and config setting working properly for my another project hosted on same server

In .htaccess file

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 file is placed parallel to application folder and under root folder.

In config.php file

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

and

$config['index_page'] = '';

current project url is like http://Hostname/ODP/ (this one not working for above code)

previous project url is http://Hostname/WCP/ (this one working for above code)

  • 写回答

1条回答 默认 最新

  • duannai1883 2013-08-05 10:24
    关注
    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]
    
    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 Macbookpro 连接热点正常上网,连接不了Wi-Fi。
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题