How to create Virtual Host from Apache .htaccess?

醉酒当歌 提交于 2019-12-05 04:55:29

The context for VirtualHost has to be server config. See the Apache docs.

This means that the directive may be used in the server configuration files (e.g., httpd.conf), but not within any or containers. It is not allowed in .htaccess files at all.

(Directive Dictionary)

Dmitri Gudkov

It seems to be impossible. Because your .htaccess is used only after your host is resolved by root configuration files of a server like httpd.conf, apache2.conf.

To put simply, .htaccess in the www directory or in its subdirectories will only be processed after root configuration files are processed.

I mean you type http://host.name and apache finds the destination and uses .htaccess file on the host to perform some operations if needed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!