【发布时间】:2013-05-26 07:57:39
【问题描述】:
我阅读了很多关于 codeigniter 的 mod_rewrite,其中很多都在谈论创建一个 .htaccess 文件并在文件内部使用类似
的内容我是 codeigniter 的初学者,所以我正在从 youtube 教程中学习。 起初我只安装了 apache 2.2 来运行我的 php,在使用带有 mod_rewrite 的 codeigniter 之后,我意识到安装 wamp 更容易,所以我卸载了 apache,mysql 然后安装了 wamp,它拥有一切。
之后,我继续学习 youtube 上关于 mod_write 的教程。我在 wamp 中激活了模块。
在根文件夹 ci_intro 中创建了这个 .htaccess 文件
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ci_intro/
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin
ErrorDocument 404 /index.php
</IfModule>
我去了config/config.php并改了
$config['index_page'] = '';
事情没有奏效。我得到了 404error 然后我在
中尝试了一些东西RewriteBase /ci_intro/
甚至还删除了整个项目,因为我在尝试 mod_write 之前备份了一些内容。即使在我检索了备份之后。我仍然没有得到error404页面。
我只是不断得到..
由于我使用的是 wamp,所以当我转到本地主机时,有一个部分说我的项目是 ci_intro...我点击它,上面的图片就出来了。 我把鼠标放在上面看看当鼠标悬停和链接显示时链接显示的是什么
[代码]http://localhost/ci_intro[CODE]
有人知道这里发生了什么吗?
【问题讨论】:
标签: .htaccess codeigniter mod-rewrite