Codeigniter - 去除URL中的index.php
2013-03-29 10:43
387 查看
在Codeigniter中默认url的形式:http://huangjacky.com/index.php/controller/action/param1/param2,那么如何去掉这个url中的index.php呢?其实我们只需要在根目录创建一个.htaccess文件,定义一下规则即可,.htaccess文件的具体内容如下:
[/code]
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
在nginx下还需要再修改一下这个重定向。等我再研究。
# Customized error messages.
[code]ErrorDocument 404 /index.php
# Set the default handler.
DirectoryIndex index.php
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
[/code]
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
在nginx下还需要再修改一下这个重定向。等我再研究。
相关文章推荐
- CodeIgniter 去掉/去除/删除 URL中index.php 的方法
- 如何去除codeIgniter开发的网站url里面的index.php字符串
- PHP框架CodeIgniter--URL去除index.php
- 教大家怎样去除codeIgniter开发的网站url里面的index.php字符串
- Thinkphp中去除URL里的index.php
- 修改apache配置文件去除thinkphp url中的index.php
- 去掉CodeIgniter(CI)默认url中的index.php的步骤(完整版)
- ThinkPHP去除url中的index.php
- thinkphp 如何去除url中的index.php
- 去掉CodeIgniter URL中的index.php
- [PHP]去掉CodeIgniter URL中的index.php
- 去掉CodeIgniter(CI)默认url中的index.php
- 修改apache配置文件去除thinkphp url中的index.php
- thinkPHP 中去除URL中的index.php
- ThinkPHP去除url中的index.php
- ThinkPHP去除url中的index.php 之设置WAMP
- ThinkPHP去除url中的index.php
- CodeIgniter 去掉 URL 中的 index.php
- ThinkPHP去除url中的index.php