2016-06-09 64 views
1

我最近将我的操作系统从Windows切换到Mac,并且在本地运行时遇到问题。我在/ Applications/MAMP下安装了MAMP。如何在Mac上用MAMP设置F3 .htaccess?

/Applications/MAMP/htdocs/.htaccess文件:

RewriteEngine On 
RewriteBase /abc/ 

# skip all files and directories from rewrite rules below 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 

RewriteRule (.+\.(?:gif|png|jpe?g|css|js|woff|ttf))$ /abc/$1 [NC,L] 
RewriteRule .* /abc/index.php [L] 

这充分的工作在我的Windows环境,但现在只加载一些资源,并引发以下错误:

Not Found (404) - HTTP 404 (GET /index.php) 

array(1) { 
[0]=> 
    array(6) { 
    ["file"]=> 
    string(42) "/Applications/MAMP/htdocs/abc/index.php" 
    ["line"]=> 
    int(27) 
    ["function"]=> 
    string(3) "run" 
    ["class"]=> 
    string(4) "Base" 
    ["type"]=> 
    string(5) "->" 
    ["args"]=> 
    array(0) { 
    } 
    } 
} 

我的网络显示它正在尝试GET localhost:8888/abc/index.php,但它正在接收404,即使这是正确的路径。

我相当肯定这是我的.htaccess文件错误,因为我的图像和字体加载正确。

+0

它没有。它存在'Applications \ MAMP \ htdocs \ abc' – jrquick

+0

显示错误的文件是'Applications \ MAMP \ htdocs \ abc \ views \ error.html' – jrquick

+0

应用程序/ MAMP/htdocs/abc/index.php存在 – jrquick

回答

2

将我的意见翻译成答案。

看起来像错误是由于index.php默认情况下不加载文件夹。您需要将此行放在.htaccess的顶部。

DirectoryIndex index.php