众所周知,IXwebhosting在一个IP下只能做一个站,独立IP用完之后,新建站的话用的都是共享IP,可是国外的IP经常面临被封的命运,所以很多人都想在一个IP下面建多个站。
点击此图片链接进入官方网站获取优惠:

用IX差不多快1年了,以前没有注意过,经过前一段时间的测试,发现完全可以实现。
因为IX的空间支持.htaccess文件,况且网站都是独立IP,所以我们将网站的域名解析到自己的独立IP,然后在独立IP所在网站的根目录建立一个子文件夹。
以www.111.com为例,是使用独立ip,现在我想再建一个www.222.org的网站。于是我先在www.111.com的根目录简历一个chamidc的文件夹,然后制作了一个.htaccess文件。
代码:
DirectoryIndex default.php index.htm index.php index.html default.htm default.html index.shtml default.shtml
RewriteEngine On
Options All -Indexes
php_value upload_max_filesize 20M
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?222.org$
RewriteCond %{REQUEST_URI} !^/chamidc/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /chamidc/$1
RewriteCond %{HTTP_HOST} ^(www.)?222.org$
RewriteRule ^(/)?$ chamidc/index.php [L]
ErrorDocument 401 /404.htm
ErrorDocument 403 /404.htm
ErrorDocument 404 /404.htm
ErrorDocument 500 /404.htm
DirectoryIndex default.php index.htm index.php index.html default.htm default.html index.shtml default.shtml
这个是定义默认首页的
RewriteEngine On
Options All -Indexes
php_value upload_max_filesize 20M
这个是修改程序上传文件大小的
RewriteEngine On
Options All -Indexes
php_value upload_max_filesize 20M
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?222.org$ 这个是域名
RewriteCond %{REQUEST_URI} !^/chamidc/ 这个是目录设置
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /chamidc/$1 目录设置
RewriteCond %{HTTP_HOST} ^(www.)?222.org$ 域名
RewriteRule ^(/)?$ chamidc/index.php [L] 默认访问的文件,可以修改成别的
上面这个就是我绑定的www.222.org的域名了,呵呵。
ErrorDocument 401 /404.htm
ErrorDocument 403 /404.htm
ErrorDocument 404 /404.htm
ErrorDocument 500 /404.htm
这些是错误文档定义。
其实.htaccess文件很强大的,可以实现很多功能,甚至可以定义php参数,比如上传文件大小,PHP程序运行时间等等,只要善于发掘,就能够实现更多的功能。