我正在尝试使用 MAMP 在本地设置 Kirby。我的 MAMP 设置我有它,所以我可以将多个站点作为虚拟主机运行。我使用这段代码:
NameVirtualHost *
<VirtualHost *>
DocumentRoot "/Applications/MAMP/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *>
DocumentRoot "/Users/oscargodson/Dropbox/projects/icarus"
ServerName dev.icarus
</VirtualHost>
当我去 dev.icarus 初始页面加载完全正常。所有的 CSS,图像,一切。一旦我尝试转到一个子页面,包括面板,我得到 404。我确定 htaccess 文件在文件夹中。我尝试使用 git install 和手动 zip 安装。我还确保在我的httpd.conf
文件中我已经打开了重写
LoadModule rewrite_module modules/mod_rewrite.so
我不确定还要查找什么。谷歌搜索只是不断返回丢失 htaccess 文件的结果。
编辑
这是每个请求的 htaccess 文件。如果我将我的项目保存在 MAMP 中的 htdocs 目录中,这是默认的。我尝试取消注释 RewriteBase 并使其只是/
(完全猜测),但这根本没有帮助。
# Kirby .htaccess
# rewrite rules
<IfModule mod_rewrite.c>
# enable awesome urls. i.e.:
# http://yourdomain.com/about-us/team
RewriteEngine on
# make sure to set the RewriteBase correctly
# if you are running the site in a subfolder.
# Otherwise links or the entire site will break.
#
# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
# RewriteBase /
# block text files in the content folder from being accessed directly
RewriteRule ^content/(.*)\.(txt|md|mdown)$ index.php [L]
# block all files in the site folder from being accessed directly
RewriteRule ^site/(.*) index.php [L]
# block all files in the kirby folder from being accessed directly
RewriteRule ^kirby/(.*) index.php [L]
# make panel links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]
# make site links work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]
</IfModule>
# Additional recommended values
# Remove comments for those you want to use.
#
# AddDefaultCharset UTF-8
#
# php_flag short_open_tag on