This is the setup I have working for mydomain.org:

<VirtualHost *:80>
  ServerAdmin webmaster@localhost
  ServerName mydomain.org
  ServerAlias *.mydomain.org
  DocumentRoot /var/www/

If I request www.mydomain.org, apache throws a 403 with the following appended to the log:

(13)Permission denied: /root/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

I've tried changing ServerName to www.mydomain.org, and changing ServerAlias to www.mydomain.org as well with no luck.

What am I missing?


Have you tried actually checking whether the .htaccess file is readable (or why Apache wants to read it)? ServerName should be mydomain.org, ServerAlias www.mydomain.org.

| improve this answer | |

You ou can not put an star (*) in ServerAlias. You should put the name you want. In your case, ServerAlias www.mydomain.org should be written. http://httpd.apache.org/docs/2.0/mod/core.html#serveralias

Edit : I found something http://httpd.apache.org/docs/2.0/vhosts/name-based.html for your problem. I think there is another problem in your configuration, like an other virtual host, with an other root directory.

| improve this answer | |
  • Yes, there was another problem. I am on Ubuntu; I have been editing /etc/apache2/sites-available/default and I had also edited /etc/apache2/httpd.conf earlier adding another VirtualHost stanza. Which is more correct to use out of the two files if I'm looking to set up several virtual hosts matching different subdomains? – sendos Apr 2 '10 at 23:47
  • Create a file in /etc/apache2/sites-available for each virtualhost you have. Don't forget to activate it with a2ensite file Then each virtualhost is easy to find and to manage. Check debian-administration.org/articles/412 – Dom Apr 4 '10 at 16:09

Sounds like you are trying to do wildcard DNS, in this case you CAN use an asterix.

Here's a good link I found: http://ma.tt/2003/10/wildcard-dns-and-sub-domains/

Also, siding with Emthigious, check your .htaccess file permissions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.