如何建立实时测试站点?
这对你们大多数人来说可能是显而易见的,但我对此很陌生。
如何设置不使用主域名的实时测试站点?目前,主域名正用于临时登陆页面,我希望在网站上线之前一直如此。我正在使用 filezilla。
我得到的建议是将其发布到服务器上的子文件夹或 htaccess 文件,以便可以将其配置为限制访问(例如通过用户名和密码),但我不确定如何做到这一点。您能否让我知道所涉及的步骤,请记住我不需要第二个域,而是要在实时服务器上测试该站点,以便其他人可以看到它但不使用主域。
非常感谢,
This is probably really obvious to most of you but i am new to this.
How do you set up a live test site that does not use the primary domain name? At the moment the primary domain name is being used for a temporary landing page and I want that to be the case until the site goes live. I am using the filezilla.
The advice I had been given was to publish it to a sub folder or the htaccess file on the server so it can be configured to restrict access (e.g. by username and password) but I am not sure how to do that. Can you let me know the steps involved, bearing in mind I do not want a second domain but to test the site on a live server so others can see it but not using the primary domain.
Many thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您所说,最简单的方法是将新站点放入子文件夹中,或者您可以为该站点创建一个新的子域。但如果不需要的话,我更喜欢域指向的文件夹中的一个简单的子文件夹。
我认为创建一个子文件夹并将文件放入其中应该不会太棘手,只需在 filezilla 中右键单击并为其命名即可。
要创建 htaccess 密码保护,您需要两个文件。
一个名为 .htacccess,另一个名为 .htpasswd(名称前面的点很重要)。
.htacces 看起来像:
.htpasswd 在每一行中包含一个具有加密密码的用户:
您可以通过谷歌找到很多示例。只需输入“htaccess htpasswd”,就会有一些生成器可以帮助您。
要进入您的网站,只需在浏览器中输入:example.com/NewSubfolder/
The simplest way is , as you said, to put the new site into an subfolder or you can create a new subdomain for that site. But if there is no need for that, i would prefer a simple subfolder in the folder the domain points to.
I think it shouldn't be too tricky to create a subfolder and put the files in it, simple rightklick in filezilla and name it.
For creating an htaccess password protection you need two files.
One called .htacccess and the other .htpasswd (the point in front of the name is important).
.htacces looks like:
.htpasswd contains in each line one user with encrypted pw:
You'll find a lot of examples via google. Just type "htaccess htpasswd", and there will be also some generator which will help you.
To enter your site, just type in browser: example.com/NewSubfolder/
实际上并没有太多——只需建立一个单独的网站,也许使用该服务器上的虚拟站点,或者可能完全在不同的服务器上。假设您正在使用相对路径,就像您应该那样,这工作得很好。
另一种技巧是将其设置到位,但使用默认文档指令将人们引导至占位符页面,除非他们知道您主页的直接 url 是什么。
Really not too much too it -- just stand up a separate website, perhaps using a virtual site on that server or perhaps on a different server entirely. Presuming you are using relative paths like you should be this works just fine.
One other trick would be to set it up in place but use the default document directive to steer people to the placeholder page unless they knew what your home page's direct url is.