How do I structure my .htaccess file(s)—using Kirby?

Posted June 3, 2015 4k views

Hi. I’m using Kirby, which comes with a standard .htaccess file. I’ve enabled .htaccess through editing /etc/apache2/apache2.conf, but I think my .htaccess is not working. (I have enabled mod_rewrite with a2enmod rewrite.)

My folder structure is as follows:

|-|-|-|-other (kirby) stuff

The relevant rewrite rules are:

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^content/(.*)\.(txt|md|mdown)$ error [R=301,L]
RewriteRule ^site/(.*) error [R=301,L]
RewriteRule ^kirby/(.*) error [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^panel/(.*) panel/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L]

I am getting a 403 error when visiting my site:

What should I change to make things work as intended? Should I place another .htaccess file in /var/www?

Many thanks in advance!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

If anyone else is having the same problem, I solved it by putting the configuration right into the apache config file, like so:

<Directory "/var/www/">