Virtual Cloud Host creates multiple site methods (. htaccess implementation)

Source: Internet
Author: User

Ali's normal version of the virtual cloud host can only build one site, but can bind multiple domain names. What if we want to create a 2 or 3 host? Do I need to buy another host?

In fact, we can use the. htaccess file to define the corresponding site directory for the associated domain name bindings, so that multiple sites are hung on a single host.

In addition, Ali virtual host can also be customized. htaccess files, we only need to connect via FTP, tick " Force Show hidden files " can be seen in the site root directory.

Using the FTP tool, right-click to edit the file:

Default content Template (archive):

Rewriteengine on<ifmodule mod_rewrite.c>rewriteengine onrewritebase/rewriterule ^index\.php$-[L]RewriteCond% {request_filename}!-frewritecond%{request_filename}!-drewriterule. /index.php [l]</ifmodule>

  

Domain Name Jump method:

Rewriteengine on<ifmodule mod_rewrite.c>rewriteengine Onrewritecond%{http_host} ^blog.abc.com [NC] RewriteRule ^ (. *) $ http://abc.com/blog/$1 [l,r=301]</ifmodule>

  

Two-level domain name binding/mapping to a subdirectory method:

Example:

Rewriteengine onrewritebase/# Mapping aaa.test.com to AAA directory Rewritecond%{http_host} ^aaa.test.com$rewritecond%{REQUEST_URI} !^/aaa/rewriterule ^ (. *) $ aaa/$1# Map bbb.test.com to BBB directory Rewritecond%{http_host} ^bbb.test.com$rewritecond%{request_ URI}!^/bbb/rewriterule ^ (. *) $ bbb/$1

  

I am using the template:

Rewriteengine on# BEGIN wordpress<ifmodule mod_rewrite.c>rewriteengine onrewritebase/rewriterule ^index\.php$- L Rewritecond%{request_filename}!-frewritecond%{request_filename}!-drewriterule. /index.php [l]# binding a.abc.com to New subdirectory Rewritecond%{http_host} ^a.abc.com$ [Nc]rewritecond%{request_uri}!^/new/ Rewriterule ^ (. *) $ new/$1 [l,qsa]</ifmodule># END WordPress

  

Virtual Cloud Host creates multiple site methods (. htaccess implementation)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.