删除MAMP上的index.php [英] Removing index.php on MAMP

查看:670
本文介绍了删除MAMP上的index.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题之前被问过,并有很多回应。问题是我没有尝试工作。

this questions was asked before and has had many responses. The problem is nothing i tried worked.

背景:我使用MAMP和我的所有web项目位于WebProjects下,我重新定位在应用程序中的MAMP文件夹中的标准位置。因此我的结构如下:

Background: i use MAMP and all of my web project are located under WebProjects which I relocated out of its standard location within the MAMP folder in Applications. so my structure is something like this:

Documents / WebProjects / GreatSite / Application /...

到目前为止发生了什么:我的理解是,删除index.php可以通过httpd.conf或.htaccess来完成。任何时候我触摸httpd.conf,Apache拒绝启动。我尝试了对.htaccess的各种编辑,包括codeigniter.com/wiki/mod-rewrite中的一个,最后一个来自SO上的一个,这是:

What happened so far: my understanding is that removing index.php can be done either through httpd.conf or .htaccess. anytime i touched httpd.conf, Apache refuses to start. I tried various edits to .htaccess including the one in codeigniter.com/wiki/mod-rewrite and the last one from a post on SO which is this:

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

这给我在访问网站时出现以下错误:

this give me the following error when i access the site:

遇到错误

无法确定应显示的内容。未在路由文件中指定默认路由。

An Error Was Encountered
Unable to determine what should be displayed. A default route has not been specified in the routing file.

我已将config.php更新为$ config ['index_page'] ='';并且我已将.htaccess文件放在GreatSite文件夹中。

I have updated config.php to have $config['index_page'] = ''; and i have placed the .htaccess file in the GreatSite folder.

另一个注意事项,我的CI系统文件夹是从GreatSite。不知道这是否有任何影响。另外,apache已经加载了模块。

One other note, my CI system folder is up a level from GreatSite. Not sure if this has any impact. also, apache has the module loaded.

所以,我希望有人已经在MAMP上成功做到这一点,并可以提供方向专门围绕他们的.htaccess的内容(甚至httpd.conf),它的位置和任何其他mods他们不得不做这个去。

so, I'm hoping someone has successfully done this on MAMP and could provide direction specifically around the content of their .htaccess (or even httpd.conf), it's location and any other mods they had to make to get this going.

更新

并尝试使用 http:// localhost:8888 / greatsite / account 将URL重写为 http:// localhost:8888 / greatsite / account / index 并给出2个错误:

消息:未定义索引:scaffolding_trigger

文件名:libraries / Router.php

行号:164

and trying to access a controller using http://localhost:8888/greatsite/account rewrites the url as http://localhost:8888/greatsite/account/index and gives 2 errors:
Message: Undefined index: scaffolding_trigger
Filename: libraries/Router.php
Line Number: 164

消息:无法修改头信息 - 已发送的头(输出开始于/Users/djeetee/Documents/DevProjects/system/libraries/Exceptions.php:166)

文件名:libraries /会话。 php

行号:662

Message: Cannot modify header information - headers already sent by (output started at /Users/djeetee/Documents/DevProjects/system/libraries/Exceptions.php:166)
Filename: libraries/Session.php
Line Number: 662

希望这有帮助。

感谢

推荐答案

.htaccess不必驻留在与index.php相同的文件夹。你可以做

.htaccess does not have to reside in the same folder as index.php. You can do

RewriteRule ^(.*)$ /codeigniter/index.php?/$1 [L]

。只要确保你有正确的RewriteBase,然后正确的路径到您的index.php和重写模块在apache启用。

for instance. Just make sure you have the correct RewriteBase and then correct path to your index.php and that the rewrite module is enabled in apache.

这篇关于删除MAMP上的index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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