[英]Removing the index.php file of codeigniter
http://codeigniter.com/user_guide/general/urls.html http://codeigniter.com/user_guide/general/urls.html
I am using a MAMP setup I access my codeigniter welcome message as follows我正在使用 MAMP 设置我访问我的 codeigniter 欢迎消息如下
http://localhost:8888/CodeIgniter_2.0.2/index.php/welcome http://localhost:8888/CodeIgniter_2.0.2/index.php/welcome
the tutorial says教程说
use a .htaccess
file as使用
.htaccess
文件作为
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
to get same message with得到相同的信息
http://localhost:8888/CodeIgniter_2.0.2/welcome http://localhost:8888/CodeIgniter_2.0.2/welcome
but I get a 404 not found error instead但我得到一个 404 not found 错误
First things first, you need to check your httpd.conf
首先,您需要检查您的
httpd.conf
Look for this line.. (the location may not be the same)找这条线..(位置可能不一样)
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
Make sure it's uncommented.确保它未注释。 Then save your changes and restart apache server.
然后保存更改并重新启动 apache 服务器。
Also, make sure that the .htaccess
file is in the same directory as your index.php
.此外,确保
.htaccess
文件与index.php
位于同一目录中。
It's usually the base directory of your CodeIgniter application.它通常是 CodeIgniter 应用程序的基本目录。
EDIT:编辑:
Also forgot to mention that you need virtual hosts for this work seamlessly.还忘了提到您需要虚拟主机才能无缝完成这项工作。
Argh, it seems your question is a repost.啊,看来您的问题是转发。 Here's another question but this is on a MAC OS X platform, with some detail on setting up your virtual hosts.
这是另一个问题,但这是在 MAC OS X 平台上,有一些关于设置虚拟主机的详细信息。
Remove "index.php" from URL - Codeigniter 从 URL - Codeigniter 中删除“index.php”
the last line should be最后一行应该是
RewriteRule ^(.*)$ index.php/$1 [L]重写规则 ^(.*)$ index.php/$1 [L]
and not并不是
RewriteRule ^(.*)$ /index.php/$1 [L]重写规则 ^(.*)$ /index.php/$1 [L]
Try to add RewriteBase on your htacces file.尝试在您的 htacces 文件中添加 RewriteBase。
RewriteEngine On RewriteBase "/CodeIgniter_2.0.2/" ...your rules here...
the instructions you followed assume you are installing code igniter in the docroot, and not a subdirectory.您遵循的说明假设您在 docroot 中安装 code igniter,而不是在子目录中。 move all your files in /CodeIgniter_2.0.2 down a directory.
将 /CodeIgniter_2.0.2 中的所有文件移到一个目录下。
mv CodeIgniter_2.0.2/* .
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.