【问题标题】:Removing index.php from codeigniter URLs从 codeigniter URL 中删除 index.php
【发布时间】:2014-10-28 16:10:19
【问题描述】:

我已经复制了代码

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

from here...

并将其复制到一个新的 .htaccess 文件中,并将其放在我的项目的根目录 (D:\xampp\htdocs\testproj) 中。 但它不起作用。
在没有 index.php 的情况下访问时显示错误 404
帮忙!

【问题讨论】:

    标签: php .htaccess codeigniter mod-rewrite xampp


    【解决方案1】:

    这就是你需要的朋友

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

    【讨论】:

    • 工作,谢谢 :) 顺便说一句,前一个不工作(官方)
    • 很高兴听到不要忘记给出答案的清单:)
    • 我会尽快...但是你能解释一下区别吗?
    猜你喜欢
    • 2016-05-14
    • 2012-06-15
    • 2012-09-21
    • 2011-10-12
    • 2017-07-16
    • 2014-02-28
    • 1970-01-01
    相关资源
    最近更新 更多