Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 显示文件夹中子域的内容_Php_Apache_.htaccess_Subdomain - Fatal编程技术网

Php 显示文件夹中子域的内容

Php 显示文件夹中子域的内容,php,apache,.htaccess,subdomain,Php,Apache,.htaccess,Subdomain,我该如何做这样的事情:(可能是使用.htaccess?或其他什么,需要最快的方法) 子域: subdomain.example.com 显示以下内容: https://example.com/folder/index.php?name=subdomain 最快的方法是什么 另外,我是否需要在ubuntu、apache或dns中设置任何内容?为apache配置添加VirtualHost条目: <VirtualHost *:80> ServerName subdomain.e

我该如何做这样的事情:(可能是使用.htaccess?或其他什么,需要最快的方法

子域:

subdomain.example.com
显示以下内容:

https://example.com/folder/index.php?name=subdomain
最快的方法是什么


另外,我是否需要在ubuntu、apache或dns中设置任何内容?

为apache配置添加VirtualHost条目:

<VirtualHost *:80>
    ServerName subdomain.example.com
    ServerAlias example.com 
    DocumentRoot /folder/index.php
</VirtualHost>

ServerName subdomain.example.com
ServerAlias example.com
DocumentRoot/folder/index.php
更改文档根目录以匹配服务器路径