PDA

View Full Version : parsing .html for SSI using .htaccess in second domain



asquier
01-29-2007, 06:17 PM
I saw some answers on the forum that were similar to this but nothing I could find that worked.

On my main site I use a .htaccess to (among other things) parse .html pages as .shtml and it works. But when I try on a 2nd domain, the .htaccess file there (which is similar) doesn't seem to be doing anything. It's serving the index.html page just fine -- it's just not parsing any of the .html pages as .shtml.

Is there any trick to getting the second domain to work?

The "main" one is here: /var/www/html/ and the second one is here: /var/www/2ndDomain/

I tried putting the .htaccess in /var/www/ hoping it would then work for both sites, but it didn't. So I put each .htaccess file in the respective directories (/var/www/html/ for the first one and /var/www/2ndDomain/ for the second one)

asquier
01-29-2007, 07:22 PM
Never mind. I got it to work by adding:

<Directory "/var/www/2ndDomain">
Options FollowSymLinks MultiViews Includes ExecCGI
AddHandler cgi-script .cgi .pl .py .sh
AllowOverride All
</Directory>

to the httpd.conf file

Hopefully this won't mess anything up security-wise. Will it?

wildjokerdesign
01-29-2007, 07:50 PM
You have allowed .cgi and perl scripts to run in /var/www/2ndDomain. Is that what you wanted? The AllowOverrides All is what made the .htaccess work. Really no security issue really that I can see. Normally better to not have cgi and perl run in the main web directory but only in a directory outside that.

Since you have been in the httpd.conf file you can see it is documented pretty well. You can can allow SSI via .html by setting the configs in httpd.conf. Can't remember off the top of my head but you should see it documented. I thought that was default on the main domain settings but may be wrong. Always better to not use .htaccess for such things when you have access to httpd.conf. You get a little better performance.

wildjokerdesign
01-29-2007, 08:04 PM
Found it:

#
# To use server-parsed HTML files
#
AddType text/html .shtml
AddHandler server-parsed .shtml .html .htm

I thought .html and .htm where set to be parsed by default. :) That is within a <IfModule mod_mime.c> tag but I think that should have set things up by default for .html.

I may have been wrong on the cgi and perl thing since the main domain dirctory allows that. When I am not sure and trying to get something to work outside the main dirctory for a second domain I pretty much use the same set up as the <Directory "/var/www/html"> which you have pretty much done so I think you should be ok.

asquier
01-29-2007, 09:03 PM
Thanks for your reply. I looked at the httpd.conf file again and it looks like they were being parsed. I use a made up extension for my include files so that's why it wasn't working. I just added that extension to the httpd.conf file and commented out the stuff on the .htaccess file and it still worked. One less thing to have in the .htaccess file.

But I still needed to have the <directory> changes made on the httpd.conf file.

I really appreciate your help.

--Adam