我试图在MAMP上运行一个没有脂肪的框架的php项目,运行在约塞米蒂10.10.1上。我有所有的项目文件在MAMP根文件夹"htdocs“和所有的无脂项目文件都位于一个无脂主dir。
具体的dir位置是: htdocs/libs/FatFreeFramework/fatfree-master。
我成功地将一个数据库导入到phpmyadmin.The中,其大小为2.5mb,但是在上传过程中没有出现任何错误,所以我认为这个大小根本不是问题!
我在apache上设置了一个虚拟主机&现在文件httpd-vhosts.conf如下所示:
ServerName localhost
DocumentRoot “/Applications/MAMP/htdocs”
<Directory "/Applications/MAMP/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from All
</Directory>
ErrorLog /Applications/MAMP/log/error.log CustomLog /Applications/MAMP/log/access.log.log组合
按照these指令对.htaccess文件进行了修改,现在看起来如下所示:
RewriteEngine打开 RewriteBase /libs/FatFreeFramework/胖-主/ RewriteCond %{REQUEST_FILENAME} !-l RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d /libs/FatFreeFramework/fatfree-master/index.php L . RewriteRule .*
我修改了重写基以指向/dirname/,然后将RewriteRule更改为/dirname/index.php
在httpd.conf中,我将目录编辑为AllowOverride,但仍然无法在浏览器上运行该项目。
我注意到有两个.htaccess文件,一个在htdocs上,另一个在无脂主dir上!
我需要编辑哪一个才能在无脂框架上重写模块呢?
我是否正确地指出了index.php的路径?
发布于 2014-12-06 19:26:07
只要使用这个.htaccess就可以了。
RewriteEngine On
RewriteCond %{REQUEST_URI} \.ini$
RewriteRule \.ini$ - [R=404]
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
发布于 2014-12-04 19:33:52
只有重要的.htaccess才是您从浏览器访问的dir中的一个(在您的情况下,在输入localhost
之后,它应该是htdocs
中的那个。
其次,检查phpinfo()
函数是否启用了mod_rewrite。如果没有,就启用它。
最后,我认为您应该将RewriteBase
设置为/
。
您还可以尝试的一件事(因为我不确定)是在Options +FollowSymLinks
后面添加RewriteEngine On
发布于 2014-12-04 15:19:22
您在Apache上启用mod_rewrite模块了吗?
我相信它驻留在httpd.conf文件中,您需要在该文件中取消对LoadModule mod_rewrite
行的注释。
https://stackoverflow.com/questions/27297369
复制相似问题