子域在localhost [英] Subdomain on localhost

查看:178
本文介绍了子域在localhost的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个子域创建(尚未在本地主机上)登记表,但我已经得到了一些问题。我知道如何创建子域,在虚拟主机例如写这些:

I would like to create a registration form which creates subdomains (yet on localhost), but I have got some problem. I know how to create subdomains, writing for example these in vhosts:

<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.hleclerc-PC.ingenidev
    DocumentRoot "C:/wamp/www/something/"
    ServerName localhost
    ServerAlias something.localhost
    ErrorLog "logs/error.log"
    CustomLog "logs/access.log" common
</VirtualHost>

并把此行中的主机:

And put this line in hosts:

127.0.0.0              something.localhost

它的工作,但我想的是,当我注册一个新的子域(例如:其他),然后当我尝试打开other.localhost,那么它打开指定的文件夹(../www/other/) 。
我与所有这些置换与服务器名称* .localhost,服务器名本地主机,ServerAlias​​ * .localhost,ServerAlias​​ localhost的,而在主机127.0.0.1 * .localhost试图在虚拟主机,但这些都不为我工作。
我曾鑫卡特它,上注册时,我把一个新的块中虚拟主机,具有最佳数据,但我不认为它是非常安全/可行/或做的最好的方式。

It's working, but what I want is that when I register a new subdomain (for example: other), then when I try to open other.localhost, then it opens the specified folder (../www/other/). I tried it in vhosts with "ServerName *.localhost", "ServerName localhost", "ServerAlias *.localhost", "ServerAlias localhost", and in hosts "127.0.0.1 *.localhost" with all of the permutation of these, but neither of these worked for me. I have thinked about it, that on registration I put a new block in vhosts, with the optimal data, but I don't think it's very safe/feasible/or the best way to do.

希望有人能帮帮我!

在此先感谢!

推荐答案

您可以尝试重写规则,其中一个子域转换成文件夹中。

You could try a rewriterule, which converts a subdomain into a folder.

例如,mystuff.localhost成为本地主机/的MyStuff

For example, mystuff.localhost becomes localhost/mystuff

otherthing.localhost /一些/ DIR /此处变成本地主机/ otherthing /一些/ DIR /此处

这篇关于子域在localhost的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆