WordPress permalinks fails with virtualhost

I have a wordpress blog in a local server: /var/www/html/blog
(In the root dir ‘/var/www/html’ there are other pages i shouldn’t move, so I cant’t put the wordpress blog in the root)

I bought a domain name and I’ve assigned it to this blog with a virtualhost. Then I activated the permalinks in the wordpress blog.

Read More

The problem is that when I go to mydomain/index.php or mydomain/, it shows a “Apache 2 Test Page” and in the apache error log it writes this message:

Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /var/www/html/blog/

If I go to mydomain/wp-login.php, it’s right. If I go to mydomain/section/blabla/, it’s right. But the index page fails.

If I comment the .htaccess file I have put in the wordpress blog, the index page works, but pages like mydomain/section/blabla/ doesn’t.

This is my virtualhost config code:

<VirtualHost *:80>
     ServerAdmin ...Mymail...
     DocumentRoot /var/www/html/blog
     ServerName ...mydomain...
</Virtualhost>

And this is my .htaccess in the wordpress directory:

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

Related posts

Leave a Reply

2 comments

  1. Solved.
    Finally I moved the blog files to the root apache directory. Then I removed the virtualhost and I created a redirection rule: mydomain/ -> mydomain/index.php

    And it works.