apache.htaccessmampkirby

Subpages aren't working in Kirby even with htaccess file


I'm trying to setup Kirby locally using MAMP. My MAMP setup I have it so I can point run multiple sites as virtual hosts. I use this code:

NameVirtualHost * 

<VirtualHost *> 
DocumentRoot "/Applications/MAMP/htdocs" 
ServerName localhost 
</VirtualHost> 

<VirtualHost *> 
DocumentRoot "/Users/oscargodson/Dropbox/projects/icarus" 
ServerName dev.icarus
</VirtualHost>

When I go to dev.icarus the initial page loads totally fine. All the CSS, images, everything. Once I try to go to a subpage, including the panel, I get the 404. I know for sure the htaccess file is in the folder. I tried using the git install and the manual zip install. I also made sure in in my httpd.conf file I have rewrite turned on

LoadModule rewrite_module modules/mod_rewrite.so

I'm not sure what else to look up. Googling just kept returning results for htaccess file being missing.

EDIT

Here's the htaccess file per request. It is the default one that works if I keep my project inside of the htdocs directory in MAMP. I tried uncommenting the RewriteBase and making it just / (a total guess) but that didn't help at all.

# 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

Solution

  • Mike Rockett in the comments pointed me in the right direction. In the httpd.conf file I had to change

    <Directory />
        Options Indexes FollowSymLinks
        AllowOverride None
    </Directory>
    

    to

    <Directory />
        Options Indexes FollowSymLinks
        AllowOverride All
    </Directory>
    

    Then I restarted MAMP and it worked!