删除Codeigniter URL中的index.php [英] Remove index.php in Codeigniter URL
本文介绍了删除Codeigniter URL中的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Codeigniter网址中删除index.php?
How to remove index.php in Codeigniter url?
http://localhost/Sample/index.php
到
http://localhost/Sample
我整天都在互联网上搜索,但没有任何效果.我正在使用Apache2.2,并且已经启用了httpd.conf中的mod_rewrite.我使用的版本是Codeigniter 2.1.4.
I've been searching whole day in the internet and nothing works. I'm using Apache2.2 and the mod_rewrite in httpd.conf have already been enabled. The version i'm using is Codeigniter 2.1.4.
请逐步教我.我对Codeigniter Framework还是很陌生.谢谢!
Please teach my step by step. I'm still very new in Codeigniter Framework. Thanks !
推荐答案
您可以在.htaccess文件中使用以下代码:
You can use the below code in your .htaccess file :
RewriteEngine On
RewriteBase /my_project_name/
# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
这篇关于删除Codeigniter URL中的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文