Forum Moderators: phranque
The index.htm and .htaccess for example.info are located in var/www/vhosts/example/ of maindomain.org.
The .htaccess code is:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.info [NC]
RewriteRule ^(.*)$ http://www.example.info/$1 [L,R=301]
Does anyone know if this method won't work if it's on a second domain of a primary account? If it should, I might have something else not set right. I did set up the www subdomain for example.info.
Yeah, I cleared the cache in Firefox, and also tried it in Opera and IE, which I hadn't checked it with previously (so there shouldn't have been a cache problem). I think it must have something to do with where it is in the VPS. The code has worked fine in maindomain.org since I first used it (actually a slight variation), a few years ago. This is the first time I've added another domain, though, and it's proving to be a learning experience. It took me a few days just to get it to resolve in the browser with the right URL, rather than showing as maindomain.org/second-domain/ - I made the mistake of putting it where the help info for the hosting company said to - /var/www/html/second-domain/index.htm. Apparently, something to do with the email was causing it to not resolve properly.
<VirtualHost *:80>
ServerName example.info
ServerAlias www.example.info
DocumentRoot /var/www/vhosts/example
<Directory "/var/www/vhosts/example">
Options FollowSymLinks MultiViews Includes ExecCGI
AddHandler cgi-script .cgi .pl .py .sh
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
(Posted in case someone else has the same problem and comes across this thread.)
Thanks, eh. It's much appreciated.
Stef
<added>I just looked at the httpd.conf and it's also there for the main domain, by default it seems. This is the first I've touched that file and I only added that code to the <VirtualHost...> part.
<added again>Just read a little on it, although I don't understand much. I don't use content management or php - just straight html. Should I yank it from the main domain as well? It's there for the main domain html folder, I believe:
<Directory "/var/www/html">
Options FollowSymLinks MultiViews Includes ExecCGI
AddHandler cgi-script .cgi .pl .py .sh
AllowOverride All
Order allow,deny
Allow from all
</Directory>
[edited by: Stefan at 5:33 pm (utc) on June 11, 2008]