Using .htaccess with FastCGI

FidoBoy picture FidoBoy · Nov 7, 2010 · Viewed 18.9k times · Source

I've readed that when using FastCGI to run PHP the .htaccess file included into the main directory of my site is ignored (right now i have the .htaccess file located in /var/www/vhosts/mydomain.com/httpdocs) My question is how can i apply the directives and flags currently on .htaccess to this domain only? can i have an httpd.conf only for this domain? where should i put the current .htaccess content to keep the same settings working?

many thanks in advance,

Answer

djn picture djn · Nov 7, 2010

Apache will read .htaccess files as long as AllowOverride is enabled in httpd.conf. What you cannot do is put PHP directives inside .htaccess: this works only with PHP installed as an Apache module and would cause a 500 Server error with PHP installed as either CGI or FastCGI.

Some configurations (with suphp and similar) allow for a per-directory php.ini with local settings. If this doesn't work with your setup you can change php.ini settings only with a series of ini_set() instructions (in an included file, most often)