我有一个OS X 10.6安装工作,安装了Apache和PHP。
但是,我不能得到mod_rewrite工作。 我的httpd.conf的内容位于: http : //pastie.org/828990
有谁知道我错过了什么重要的事情?
您还需要更新/etc/apache2/users/[name].conf,其中name是您计算机上的用户名。
如果该文件不存在,请创build它。 然后更新它以允许mod_rewrite规则:
<Directory "/Users/[name]/Sites/"> Options Indexes MultiViews AllowOverride All Order allow,deny Allow from all </Directory>
基思·诺曼的答案是正确的。 但是,在我的情况下 – 一个我用来进行hobby / testing的cusual home服务器 – 我直接从HTTP服务器的“base”目录下工作,而不是/~user 〜user目录。 因此,我需要在/private/etc/apache2/httpd.conf更改以下行:
# AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All
以前它说:
AllowOverride None
你需要在你的configuration中的某个地方使用“RewriteEngine = on”,但是我不能在任何地方看到它。 这打开了RewriteRule等。