Problem changing permalinks on wordpress install without .haccess file

Posted by evolution800@reddit | linuxadmin | View on Reddit | 0 comments

I have wordpress install on debian 12 server with apache. I want to be able to change the permalinks settings to custom structure without using .htaccess file and only using the apache virtual host file but for some reason it doesn't work. This is the content of the virtual host file:

<VirtualHost *:80>
    ServerName mywebsite.com
    ServerAlias www.mywebsite.com
    DocumentRoot /var/www/mywebsite/
    ErrorLog ${APACHE_LOG_DIR}/site1-error.log
    CustomLog ${APACHE_LOG_DIR}/site1-access.log combined
    <Directory /var/www/mywebsite/>
        AllowOverride None
        Options FollowSymlinks
        Require all granted

        RewriteEngine On
        RewriteBase /
        RewriteRule ^index\.php$ - [L]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
     </Directory>
</VirtualHost>