raksmart活动促销

分享

写回答

发帖

一basic空间同时安装多个网站经验分享

国外虚拟主机 国外虚拟主机 1320 人阅读 | 1 人回复

发表于 2008-8-7 13:32:24 | 显示全部楼层 |阅读模式

搞了几天总算…… 哎 还是多时间为好,我安装zc不下20次,现在安装成功和大家分享!!!


安装多站会遇到的问题往往就是多个站会彼此不独立,出现互相乱链的结果。例如a的网页打开后显示在b的下面,点击www.a.com,出现的网页地址会是www.b.com/xxxx.html之类的网页,这样就造成了极大的麻烦!多数程序安装都会要求选择按章在那个域名下面,所以要先add domains指向某一文件夹,然后再他的文件夹里开展工作……

lp默认的域名是指向默认文件夹public_html下面的,如果你将程序裸放在这个文件夹里边那么他会默认指向给程序的index.php,但如果你考虑到以后会见多站,或者是嫌弃程序方的乱糟糟,那么最好用文件夹装起来,假如是a文件夹,接下来你就不会用默认域名访问到该网站了,因为应尽出现了“秘密转移”了,你必须用.htaccess文件将此域名指向a文件夹,.htaccess的格式如下,只需修改下面4到5个地方就好:


# www.host114.org
# .htaccess main domain to subfolder redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.

RewriteEngine on
# Change yourdomain.com to be your main domain.

RewriteCond %{HTTP_HOST} ^(www.)?yourmain.com$

# Change ’subfolder’ to be the folder you will use for your main domain.

RewriteCond %{REQUEST_URI} !^/要指向的文件件/

# Don’t change this line.

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

# Change ’subfolder’ to be the folder you will use for your main domain.

RewriteRule ^(.*)$ /要指向的的文件夹/$1

# Change yourdomain.com to be your main domain again.

# Change ’subfolder’ to be the folder you will use for your main domain  2/41

# followed by / then the main file for your site, index.php, index.html, etc.

RewriteCond %{HTTP_HOST} ^(www.)?yourmain.com$

RewriteRule ^(/)?$ 要指向的文件夹/index.php [L]


这个要指向的文件夹必须放在默认玉米下面!youdomain就是你的玉米
这样新添加的玉米就会指向某一特定的网站且不会乱链……

好 结束……
后续

回答|共 1 个

lieser

发表于 2009-12-19 19:54:51 | 显示全部楼层

好思路,谢谢楼主分享
您需要登录后才可以回帖 登录 | 注册

本版积分规则