htaccess的重写规则不工作正确的MAC [英] .htaccess rewriterule not working correct on mac

查看:319
本文介绍了htaccess的重写规则不工作正确的MAC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的Mac书亲豹一个网站项目,而我使用内置的Apache2和PHP。我做了我的配置,两者的httpd.conf和user.conf的使用htaccess的。像做了更改:

I have a website project on my mac book pro leopard, and I am using built in apache2 and php. I've made my configurations in both httpd.conf and user.conf to use htaccess. Changes done like :

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

<Directory >
    AllowOverride All
</Directory>

现在的问题是,当我想打开像一个网站 本地主机/〜用户名/网站/网站/的index.php /欢迎,index.php文件做一些操作,并找到正确的控制器和右页。

The problem is when i want to open a site like localhost/~username/site/site/index.php/welcome, index.php does some operations and finds the right controller and the right page.

但是,当我试图进入网站,如网站/欢迎阿帕奇给了我以下错误:

But when I try to enter site like site/welcome apache gives me the following error :

未找到

所请求的网址用户/用户名/网站/网站/的index.php /欢迎在此服务器上找到。

The requested URL Users/username/Sites/site/index.php/welcome was not found on this server.

现在的问题是阿帕奇得到这个像它确实是一个文件和错误陈述给它在文件系统的方式,但这一要求就必须获取到index.php代替。

The problem is apache gets this like it is indeed a file and the error statement gives it in a file system way, but this request must be fetched to index.php instead.

我的.htaccess文件看起来像这样

my .htaccess file looks like this

<ifModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [NC,QSA,L]
</ifModule>

让我困扰的是,本配置适用于Linux和Windows,但不会在Mac上运行。我觉得注定:)

What bothers me that this configuration works on both Linux and Windows but does not work on Mac. I feel doomed : )

推荐答案

我遇到了同样的问题呢! DocumentRoot的不为我的狮子工作。

I met the same problem too! 'DocumentRoot' doesn't work for me in Lion.

不过,这部作品:

RewriteEngine On

RewriteBase /~username/YOURPath

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

这篇关于htaccess的重写规则不工作正确的MAC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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