PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, September 21, 2022

[FIXED] How to create Virtual Host from Apache .htaccess?

 September 21, 2022     .htaccess, apache, mod-rewrite, url-rewriting, virtualhost     No comments   

Issue

I am using Apache Friends XAMPP in Windows (Local Server). I setup the virtual host in httpd-vhosts.conf in an Apache configuration directory like this

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName test.example.com
    DocumentRoot "E:\xampp\htdocs\example"
</VirtualHost>

This works fine when I browse the URL

http://test.example.com

Is it possible to create virtual host from Apache .htaccess dynamically?


Solution

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)



Answered By - Matthias
Answer Checked By - Cary Denson (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing