htaccess的重写规则不工作正确的MAC

编程入门 行业动态 更新时间:2024-10-25 19:27:41
本文介绍了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

本文发布于:2023-11-16 18:23:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1606708.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重写   正确   规则   工作   htaccess

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!