网站首页指向子目录有很多种做法。第一种做法修改.htaccess文件,做好301跳转。第二种做法,如果你用的是cpanel面板,那么cpanel面板中可以自行修改域名绑定到目录。如果你是购买的大名鼎鼎的raksmart vps,可以参考这篇文章

http://raksmart.idcspy.com/226

先说第一种做法,我们主要针对linux操作系统。

在你的空间根目录中新建.htaccess文件,有的空间看不到这个文件。有两种情况,第一种情况来自于空间隐藏了这个文件,第二种情况是网站空间本身就没有这个文件。我们可以新建这个文件,在本地计算机桌面建立一个txt文本文件,然后修改文件名就可以了。在.htaccess中编辑重定向规则如下

# 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.)?yourmaindomain.com$

 

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

 

RewriteCond %{REQUEST_URI} !^/subfolder/

 

# 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 ^(.*)$ /subfolder/$1

 

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

 

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

 

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

 

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

 

RewriteRule ^(/)?$ subfolder/index.php [L]

这是第一种方法,第二种方法是在cpanel附加域中设置。他会在capnel控制面板的子目录下面新建文件夹。你的主域名可以直接绑定到public_html下面你所设定的子目录。