codeIgniter - 如何从URL中隐藏的index.php [英] CodeIgniter - How to hide index.php from the URL

查看:251
本文介绍了codeIgniter - 如何从URL中隐藏的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的的.htaccess 的样子。该的.htaccess 坐在 / WWW /脚本目录是codeigniter的<$ C $的父C>系统目录,其中还包含的index.php 。我已经启用的mod_rewrite 在我的Apache 2.2.x中这是Ubuntu 9.10的服务器上。

我跟着这个<一href="http://stackoverflow.com/questions/1445385/how-to-remove-index-php-in-$c$cigniters-path">link,但它不工作。有什么我需要做的Apache2,任何特定的配置,使这个工程?

  RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$的index.php / $ 1 [QSA,L]
 

解决方案

使用这样的:

  RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME!-f
的RewriteCond%{} REQUEST_FILENAME!-d
重写规则^(。*)$ /folder/index.php/$1 [L]
 

This is what my .htaccess looks like. The .htaccess is sitting in /www/scripts directory which is the parent of codeigniter's system directory and which also contains index.php. I have enabled mod_rewrite in my Apache 2.2.x. This is on Ubuntu 9.10 server.

I followed this link, but it does not work. Is there anything I need to do in apache2, any specific configuration so that this works?

RewriteEngine on 
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

解决方案

use this:

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

这篇关于codeIgniter - 如何从URL中隐藏的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆