从 Codeigniter 中的 URL 中删除 index.php [英] Remove index.php from URL in Codeigniter
问题描述
我已经做了很多次了.但除此之外,我再次被困在这里(在不同的服务器中)并且无法弄清楚是什么问题.
I have done this lots of time. But than also I am stuck here again (in a different server) and can not figure out what is the issue.
完成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>
- 重写模块已启用(如客户服务人员所说)
错误:
内部服务器错误
服务器遇到内部错误或配置错误,无法完成您的请求.
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 Internal Server Error 错误.
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.
这篇关于从 Codeigniter 中的 URL 中删除 index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!