FAQ Categories

Ask A Question

Question to be answered.
Longer question text.

WWW Resources

Hosted by WestHost

How do I enable .htaccess files on secondary domain?

Users often get a 500 server error when they try to use a .htaccess file on a secondary domain they have added to their WH 3.0 account. This is how you can fix that. You must modify the VirtualHost tag for the secondary domain in your httpd.conf. You must then restart Apache for the changes to take effect.

File to edit: /etc/httpd/conf/httpd.conf

Code:

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com
  DocumentRoot /path/to/secondary/domain
  <Directory "/path/to/secondary/domain">
    Options FollowSymLinks MultiViews Includes ExecCGI
    AddHandler cgi-script .cgi .pl .py .sh
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

 

More Detail: 
The above is just an example of what your the final code should look like. ServerName, ServerAlias and DocumentRoot should already be set correctly to your secondary domain.  This is what Site Manager adds to httpd.conf when you add a new domain.  You are adding the text that falls between the Directory tags. Simply use the path that was set for DocumentRoot in your opening Directory tag.  Notice that this path is in double quotes.

The Directives Options and AddHandler do not actually effect .htaccess but they well allow your secondary domain to function like your main domain in regards to cgi/perl script, servers side includes and the handling of links. The Directives AllowOverride, Order and Allow are the ones that are actually activating the use of .htaccess files.

In order to have your changes take effect you must restart Apache.  There are two ways that you can do this. If you are logged into your account via SSH, you can simply issue the command restart.  Alternatively you can log into Site Manager and use the Restart Account link under Account Settings.

Resource Links:
Apache Core Features This is a list of the Directives used in this tutorial.

 

Powered by Drupal, an open source content management system