kmassada
kmassada

Reputation: 273

How to rewrite directive on apache for anchor cms

I'm using a cms called anchor. http://anchorcms.com/docs/getting-started/configuration

when I go to domain.com/posts I get a 404,

when I go to domain.com/index.php/posts page is displayed correctly.

this is my httpd.conf file

<VirtualHost *:443>
#ssl blah blah

DocumentRoot /var/www/anchor/
ServerName domain.com
ServerAlias domain.com

<Directory /var/www/anchor/anchor/>
    AllowOverride All
    Options Includes MultiViews
    Require all granted
</Directory>

</VirtualHost>

this is my .htaccess file placed inside /var/www/anchor/

Options -indexes

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Allow any files or directories that exist to be displayed directly
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d

        # Rewrite all other URLs to index.php/URL
        RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
        ErrorDocument 404 index.php
</IfModule>

I'm a little confused as how to configure this cms, the .htcaccess supposed to go in the "document root", which I'm fairly sure I put in the correct folder. I don't think I have to set the url to a sub directory. any tips?

here's my config file. /var/www/anchor/anchor/config/app.php

<?php

return array(
        'url' => '/',
        'index' => '',

Upvotes: 2

Views: 415

Answers (1)

Jeremiah Winsley
Jeremiah Winsley

Reputation: 2557

Your document root is /var/www/anchor, but you only allow overrides on /var/www/anchor/anchor. If you're not globally allowing overrides, that would disable your htaccess file. Try changing your <Directory> tag to match the document root:

<Directory /var/www/anchor>
    AllowOverride All
    Options Includes MultiViews
    Require all granted
</Directory>

Upvotes: 1

Related Questions