从Codeigniter中的URL中删除index.php

问题描述:

我做了这么多时间。

完成htaccess编辑

Completed htaccess editing

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /glt.me/CI/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /glt.me/CI/index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>




  • 重写模块已启用(根据客户服务perons说) li>
  • 错误:

    • rewrite module is enabled (as per customer care perons says)
    • Error :

      内部伺服器错误

      内部错误或配置错误,无法完成您的请求。

      The server encountered an internal error or misconfiguration and was unable to complete your request.

      请与服务器管理员cgiadmin@yourhostingaccount.com联系,并通知他们错误发生的时间,

      Please contact the server administrator, cgiadmin@yourhostingaccount.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

      有关此错误的详细信息可在服务器错误日志中找到。

      More information about this error may be available in the server error log.

      此外,在尝试使用ErrorDocument处理请求时遇到500个内部服务器错误错误。

      Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

      测试此案例:

      http://glt.me/CI/test
      http://glt.me/CI/index.php/test
      


这是简单的方法,它从你的url中删除index.php工作正常

This is the simple way and it works fine for removing index.php from your url

RewriteEngine on
RewriteCond $1 !^(index\.php|uploads|css|js|lib|img|bootstrap|robots\.txt)
RewriteRule ^(.*)$ /manage/index.php/$1 [L]

instead of manage put your own application folder name.