简体   繁体   English

如何:本地目录结构最佳做法+本地目录结构是否与Web主机结构匹配?

[英]how: local directory structure best practice + have local directory structure match web host structure?

Here is my (probably very silly) newbie method of working on projects. 这是我(可能很愚蠢)的项目新手方法。

I have a directory C:\\websites\\ and I keep separate folders for all my sites in there. 我有一个目录C:\\ websites \\,并且在那里存放所有网站的单独文件夹。

Whenever I want to work on one of those sites, I copy and paste the files for that site from it's directory within C:\\websites\\ - for example: 每当我要在这些网站之一上工作时,我都会从C:\\ websites \\中的目录复制并粘贴该网站的文件-例如:

C:\\websites\\website_one\\*.* (just the files, not the directory) - and put those files straight in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\ - then open those files in notepad++. C:\\ websites \\ website_one \\ *。*(只是文件,而不是目录)-并将这些文件直接放入C:\\ Program Files \\ Apache Software Foundation \\ Apache2.2 \\ htdocs \\-然后在notepad ++中打开这些文件。

It is extremely annoying to have to move the website I no longer want to work on for that day back to C:\\websites\\, and to move a different website into htdocs\\ every time I want to work on a different website. 不得不将我当天不想工作的网站移回C:\\ websites \\,并且每次我想在其他网站上工作时都将另一个网站迁移到htdocs \\中,这是非常烦人的。

Could anyone help me with the standard way of structuring the directories of your local development sites? 有人可以在构建本地开发站点目录的标准方法方面帮助我吗?

I want to be able to access/work on my different projects more easily, and also be able to upload any of them for online testing and not have to change any links/includes because the directory structure doesn't match. 我希望能够更轻松地访问/处理我的不同项目,还希望能够上载它们以进行在线测试,而不必更改任何链接/包含项,因为目录结构不匹配。

Locally, should I just replicate the web hosts directory structure in htdocs? 在本地,我应该只在htdocs中复制Web主机目录结构吗? For example: 例如:

htdocs\\public_html\\website_one htdocs \\ public_html \\ website_one

htdocs\\public_html\\website_two htdocs \\ public_html \\ website_two

Or something similar? 还是类似的东西?

Thanks for any insight into this. 感谢您对此的任何见解。

Since you work with Apache anyways, why not work with sub domains or url rewrites? 由于无论如何都使用Apache,为什么不使用子域或URL重写呢?

Heres a link to set up sub domains. 这是设置子域的链接。 http://www.sitepoint.com/forums/showthread.php?394472-Setting-up-Subdomains-on-Localhost-Apache http://www.sitepoint.com/forums/showthread.php?394472-Setting-up-Subdomains-on-Localhost-Apache

Each site can be in its own folder, do keep in mind that includes or links should be based on the root of the website, not the root of the webserver. 每个站点都可以位于自己的文件夹中,请记住,包含或链接应基于网站的根目录而不是网站服务器的根目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM