Htaccess and php

Hi,

I have a problem with Kirby and htaccess…
I have a kirby in a root folder like this (with more files)
/kirby
/media
/content

In the same root I have
/demo/index.php
/demo/index.html

I can read index.html but index.php go to kirby 404…

Why ?

The issue might be with the rewrite rules in your .htaccess file. The rule RewriteRule ^(.*) index.php [L] is telling Apache to route all requests to index.php, which is causing the Kirby routing to override requests for /demo/index.php.

To fix this, you could add a condition to exclude the /demo directory from the rewrite rule. Here’s how you could modify your .htaccess file:

DirectoryIndex index.php index.htm index.html

# disable directory listing
Options -Indexes

# rewrite rules
<IfModule mod_rewrite.c>

RewriteEngine on

# Exclude the /demo directory from the rewrite rule
RewriteCond %{REQUEST_URI} !^/demo/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# make sure to set the RewriteBase correctly
# for your domain and subfolders. Otherwise
# the installation of kirby won't work

RewriteBase /
RewriteRule ^(.*) index.php [L]
 
</IfModule>

:cry: Nothing change…
If I remove the htaccess, it’s work… so it’s a htaccess problem :frowning:

Which Kirby Version are you using?
Apache or nginx?
I just tested it locally with the current plainkit.
It even works without any changes to the htaccess
note: you must use your.url/demo/index.php as url.

I try locally, it’s work without specific rules… may be it’s my php/apache config.

Arrrg, that was a chmod problem ^-^