Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
只是缺少使用mod_rewrite的Apple PHP配置_Php_Macos_Apache - Fatal编程技术网

只是缺少使用mod_rewrite的Apple PHP配置

只是缺少使用mod_rewrite的Apple PHP配置,php,macos,apache,Php,Macos,Apache,我正试图通过将.html转换为.php来修改一个遗留站点,以便于将来的配置。为了实现这一点,我在MacOSX10.9机器上的Apache服务器中工作。我已经编写了一个users.conf文件,它使用mod_rewrite将以.html结尾的文件名重新映射为.php 我昨天下班时,它工作正常,但今天我在前端收到一个“您没有访问权限”错误,在后端收到一个“[error][client::1]client被服务器配置拒绝:”当我尝试访问localhost/~user/somefile.html.php

我正试图通过将.html转换为.php来修改一个遗留站点,以便于将来的配置。为了实现这一点,我在MacOSX10.9机器上的Apache服务器中工作。我已经编写了一个users.conf文件,它使用mod_rewrite将以.html结尾的文件名重新映射为.php

我昨天下班时,它工作正常,但今天我在前端收到一个“您没有访问权限”错误,在后端收到一个“[error][client::1]client被服务器配置拒绝:”当我尝试访问localhost/~user/somefile.html.php时,所有文件权限都设置正确(644或755,视情况而定)

似乎只有名为somefile.html.php的文件才会出现这种情况。名为.html的文件加载精细,名为.php的文件加载精细。Apache版本是2.2.24

下面是user.conf:

<Directory "/Users/user/Sites/mySite">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

<Directory "/Users/user/Sites/mySite">
           RewriteEngine on
           RewriteCond %{REQUEST_FILENAME}.php -f
           RewriteRule ^(.*\.html) $1.php
</Directory>

选项索引多视图跟随符号链接
允许超越所有
命令允许,拒绝
通融
重新启动发动机
RewriteCond%{REQUEST_FILENAME}.php-f
重写规则^(.*\.html)$1.php
以下是httpd.conf的相关部分:

DocumentRoot "/Users/user/Sites"
LoadModule php5_module libexec/apache2/libphp5.so
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "/Users/user/Sites">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
DocumentRoot”/Users/user/Sites
LoadModule php5_module libexec/apache2/libphp5.so
选项如下符号链接
不允许超限
命令拒绝,允许
全盘否定
选项索引跟随符号链接多视图
允许超越所有
命令允许,拒绝
通融

也许我混合了太多教程?

答案是我还需要配置虚拟主机


获得风滚草徽章。好极了!