Subpages fail on Apache 2.4

Hello everyone!
I’m building a page with Kirby and it’s working like a charm on my local MAMP but when moved to Apache 2.4, no page except for home is working.
All I get is ‘The requested URL /XXXX was not found on this server.’

The module mod_rewrite is enabled

Half a kingdom for a solution

here is my htcaccess

       # 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

Have you tried uncommenting the RewriteBase line?

Hey, thanks for replying
I believe that line is already uncommented:

# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
RewriteBase /

Sorry, of course I meant the exact opposite :flushed:

# If your homepage is http://yourdomain.com/mysite
# Set the RewriteBase to:
#
#RewriteBase /

Haha, I tried it both ways so the comment is still relevant.
This line has been commented, uncommented, set to /, blank, /kirby etc and it’s all the same issue at the end of each try

Sounds as if the .htaccess file is ignored? Do you have access to the server configuration files?

Edit: you could try to set the url in your config file:

c::set('url','http://yourdomain.com');

Yep, I do: any hints on what I should look for there?

I was thinking about the c::set before, but I’m not sure whether that will be a good solution if I am planning to do subdomains from the folders like this:

Folders:
1-First
2-Second

URL
first.domain.com
second.domain.com
and so on

Do you think c.set will hold in this situation?

You can check if your httpd.conf allows overriding:

AllowOverride All

What are those folders? Are they different Kirby installations? Or do you use a multi-site setup?

If those folders are all separate Kirby installations and you point your subdomain to one of them, you can use that subdomain in your config without any problems (if it solves the problem, that is)

Edit: You could also just write some nonsense stuff into your .htaccess. If you get an internal server error, the .htaccess is not ignored.

Tried it out: you were right about the server ignoring the file altogether.

The AllowOverride setting didn’t fix the problem, but here’s what did: getting rid of .htaccess altogether and putting the settings into server configuration – Apache can and prefers to roll without .htaccess

Thank you for your help, texnixe, you get quater kingdom and a horse. Can ship via DHL :slight_smile:

1 Like

You’re welcome :grinning:

In fact, that’s how it’s done on my server as well.