将 .htaccess 与 FastCGI 一起使用
我读过,当使用 FastCGI 运行 PHP 时,我的网站主目录中包含的 .htaccess 文件将被忽略(现在我的 .htaccess 文件位于 /var/www/vhosts/mydomain.com/httpdocs 中)问题是我如何才能将 .htaccess 当前的指令和标志仅应用到该域?我可以有一个仅用于该域的 httpd.conf 吗?我应该将当前的 .htaccess 内容放在哪里才能保持相同的设置正常工作?
预先非常感谢,
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,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只要启用 AllowOverride,Apache 就会读取 .htaccess 文件httpd.conf。您不能做的是将 PHP 指令放入 .htaccess 中:这只适用于作为 Apache 模块安装的 PHP,并且当 PHP 作为 CGI 或 FastCGI 安装时会导致
500 服务器错误
。某些配置(使用 suphp 和类似配置)允许每个目录 php.ini 具有本地设置。如果这不适用于您的设置,您只能使用一系列
ini_set()
指令更改 php.ini 设置(通常在包含的文件中)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 ofini_set()
instructions (in an included file, most often)