Use Linux shared host, control surface version is Cpanel's friends know that he default binding the primary domain name root directory is public_html
So if you want to put the domain name yourdomain.com can directly access, it is necessary to all files directly into the public_html. At this time if you want to build a station, bbs.yourdomain.com, then the BBS directory and other PHP files or the main station folder mixed together, very detrimental to management.
The General Linux host supports the. htaccess file, so we can use the. htaccess file to implement the steering
The following is a blog directory and blog.shuxiong.net domain name for example to explain
Copy Code code as follows:
# Open function
Rewriteengine on
# you want to bind the two-level domain name
Rewritecond%{http_host} ^ (blog.)? shuxiong.net$
# point that subdirectory to the level two domain that you want to bind
# Here's an example of a subdirectory blog directory
Rewritecond%{request_uri}!^/blog/
Rewritecond%{request_filename}!-f
Rewritecond%{request_filename}!-d
Rewriterule ^ (. *) $/cms/$1
#这里改成要绑定的二级域名和要绑定的子目录
Rewritecond%{http_host} ^ (blog.)? shuxiong.net$
Rewriterule ^ (/) $ blog/index.php [L]
Save the above code as a. htaccess file and upload it to the root directory (e.g., public_html directory) in ASCII mode.
Windows can not be renamed to. htaccess, this time first named Abc.htaccess, upload to the server, with the FTP tool renamed to. htaccess is OK.
above. htaccess content is the target directory blog to point to level two domain name blog.shuxiong.net
such as blog.shuxiong.net, access to the directory directly to the blog
Supplemental: You must first bind a level two domain name to the host root directory (e.g., bind to www.abc.com directory)