Quick Create Site 3.2 WordPress multi-site and Azure online editor-Throw away your FTP tool, modify code all in the cloud

Source: Internet
Author: User
Tags multisite server hosting wordpress multisite

This article is the 6th of the fast-track creation series, and if you have not read the previous content, it is recommended that you click on the chapters in the following directory to read the other content before returning to this article.

1. Website management platform WordPress and cloud computing Platform Azure Introduction (6 minutes this article)
2.1 Creating websites and Web site operations on Azure (13 minutes)
2.2 Domain binding operations and Azure load balancing mechanism (12 minutes)
2.3 WordPress initialization and website management function (11 minutes)
3.1 WordPress Data import (12 minutes)
3.2 WordPress Multi-site support and Azure online Code Editor (14 minutes)
3.3 WordPress Multi-language support multisite Language switcher (15 mins)
3.4 WordPress Theme Installation and configuration to beautify your website (15 mins)
4.1 Visual Studio Online (VSO) development platform (11 minutes)
4.2 Build a DevOps environment with Visual Studio Online and Azure (13 minutes)

In the previous section (3.1), we have completed the data import. In this section (3.2), I will make a multi-site upgrade to WordPress, let my Chinese content on the http://anb.io/this main station, while the http://anb.io/en/on the English content. The equivalent of creating a subweb in our website, and this sub-site has the same function as the main station, after we add the multi-language switch plug-in, we can enable Chinese on the main station, enable English on/en's sub-station, form a multi-lingual site group.

This part of the content for users who do not have the experience of development may be slightly more complicated, because we need to manually update the wordpress background code. But don't worry, I won't use any of the development tools throughout the operation, and all of the operations are done in the browser.

Please read this article in conjunction with the video http://v.qq.com/page/h/o/b/h0147djt7ob.html
Microsoft Visual Studio Online editor

In order to be able to complete the WordPress multi-language mode upgrade, we need to make simple changes to the WordPress background code files. In general, modifications to the site's background files require a download-update-upload process, but with the online editor of Visual Studio Online integrated in Microsoft Azure cloud computing, we can easily do all of the work with the browser.

Enable the Visual Studio Online Editor: Click Configure on the website dashboard of the Azure portal

In the configuration page, locate the EDIT in VISUAL STUDIO ONLINE option, click Open, and save the configuration

Go back to the dashboard page, find the Edit link in Visual Studio online in the quick glance on the right, and click Enter Editor

After entering the editor, you can see that the list of files on the WordPress Web site appears on the left.

Here, we see a full-featured online IDE (integrated development environment) that supports not only simple editing of files, but also intelligent analysis and development assistance for code. The codename of the Visual Studio online editor is "Monaco" and is currently supported by the language environment used for web development, please refer to the following videos and links.

My presentation video on Monaco in the keynote speech on MVP ComCamp2015:
Http://v.qq.com/page/y/i/s/y0147bi71is.html


Note: a node. js application is used in this video. The first half of the video is an introduction to the Development Platform section of Visual Studio online, and the second half is an introduction to the online editor, as well as a demo integrated with GitHub.

Trailer: In the final part of this series (4.1), I'll also show you how to use visual Studio online and Azure integration for WordPress code management and the build of a local development environment.

Monaco Video Summary on MSDN Channel 9
Http://channel9.msdn.com/Series/Visual-Studio-Online-Monaco

Blog of the Monaco development team
http://blogs.msdn.com/b/monaco/

WordPress Multi-site Mode upgrade operation

WordPress Multi-site mode belongs to the advanced features of WordPress, there is no direct configuration on the interface options, must be modified by the background code activation. This is a valuable feature for the students who run the website.

On the various websites we use frequently, we will often see the application of multi-site mode, for example: Sina's multi-site

http://www.sina.com.cn/: This is the main station, as the first entrance to the entire site
http://news.sina.com.cn/: This is the news sub-station
http://tech.sina.com.cn/: This is the technology sub-station

The above multi-site mode is called sub-domain, for more content sites, we can use subdomains (that is, the first part of the domain name) to distinguish between different functions/content areas.

Look at the following Sina for science and technology sub-station classification:

http://tech.sina.com.cn/internet/: Internet content in science and technology sub-stations
http://tech.sina.com.cn/tele/: The content of telecommunication in science and technology sub-station
http://tech.sina.com.cn/discovery/: Popular Science content in science and technology sub-station

Above this multi-site mode is called: subdirectory mode, for the same large classification under the small classification, you can use subdirectories to further divide the way.

Of course, we can use either of these two modes or mix them. Choose according to your site size and mode of work. Multi-site mode not only affects how your users consume content, but also has an impact on the working mode of the website backstage, the content of different categories is generally managed by different departments/professionals, and we need to control the rights of these users. With multi-site mode, we can easily manage different users according to different departments/disciplines, and carry out hierarchical authorization. Therefore, WordPress can be used as a solution to the Enterprise Portal completely.

Multi-site planning

As can be seen from the above example, multi-site needs to be planned, and once the multi-site is enabled, its structure is difficult to adjust, need to plan ahead.

According to my plan, the user will use Http://anb.io as the unified entrance, in accordance with the different languages used by the client to enter the Chinese or English sub-station, in the middle using the multi-language switch plug-in connection, to form the following access experience.

As you can see, the two different language versions of the same article are linked using the multilingual toggle tool on the right side of the page, and users can jump to the appropriate language version by clicking on the language option. WordPress will also be based on the user's browser language settings automatically will be the first time to enter the site of the user directly to the different languages of the first page.

Note that the URLs of the two articles are different, but they can be easily divided into different languages, and this format will also be helpful to search engine optimization.
http://anb.io/blog/opensource-freetools-crossplatform-mvp-comcamp2015-keynote/
http://anb.io/en/opensource-freetools-crossplatform-mvp-comcamp2015-keynote/

Since there is no need for all content to be available in 2 languages, the respective language's blog home page will only show links to articles that already provide the current language, such as:

WordPress Multi-Site upgrade operation

First of all, you can use the official WordPress document to learn about WordPress multi-site features, which listed a variety of prerequisites and main operating procedures. However, because the WordPress article is mainly for the linux/apache/mysql environment, in the use of the WordPress on the operation of the time slightly different, for this series of the operations involved see below.

WordPress Multisite mode document: Http://codex.wordpress.org/Create_A_Network

Operation Steps

  1. To edit the wp-config.php file, activate the multisite upgrade mode using the online editor that was previously opened, and locate the following code in the wp-config.php file/* That‘s all, stop editing! Happy blogging. */

    and add the following code below this line of codedefine( ‘WP_ALLOW_MULTISITE‘, true ); 

    It means to tell WordPress: Please activate multi-site upgrade mode. Such as

    Note: You do not need to save when editing in Monaco, it will complete the save operation automatically.

  2. After the modification is complete, switch back to your WordPress console homepage and the Network setup option will appear under the Tools menu


    Select this option to go to the multisite Upgrade boot page, and the bootloader will first prompt you to temporarily close the plugin in your site to complete the upgrade. Click the Deactivate your plugin link and deactivate all the plugins back to this boot page.


    At this point, WordPress can be a multi-site upgrade, and then click on the following page directly install.


    Then WordPress will prompt you to modify the configuration file again, this time you need to modify the wp-config.php and Web. config file respectively.the wp-config.php changes are as follows:Replace the line of code we added earlier with the following code
    Note: Be sure to replace, rather than keep the original code, before that line of code just activates the upgrade mode, now has completed the upgrade, we need to configure the multi-site mode.

    define(‘MULTISITE‘, true);
    define(‘SUBDOMAIN_INSTALL‘, false);
    define(‘DOMAIN_CURRENT_SITE‘, ‘www.anblogs.net‘);
    define(‘PATH_CURRENT_SITE‘, ‘/‘);
    define(‘SITE_ID_CURRENT_SITE‘, 1);
    define(‘BLOG_ID_CURRENT_SITE‘, 1);

    Note the above define (' Subdomain_install ', false), here to use false. Because we are multi-site using subdirectory mode instead of sub-domain method.

    The changes to Web. config are as follows:
    Note: WordPress directly gives the configuration file is wrong, please use the following configuration to complete the modification.

    <rewrite>
    <rules>
    <rule name= "WordPress rule 1" stopprocessing= "true" >
    <match url= "^index\.php$" ignorecase= "false"/>
    <action type= "None"/>
    </rule>
    <rule name= "WordPress rule 2" stopprocessing= "true" >
    <match url= "^ ([_0-9a-za-z-]+/)? files/(. +)" ignorecase= "false"/>
    <action type= "Rewrite" Url= "Wp-includes/ms-files.php?file={r:2}" appendquerystring= "false"/>
    </rule>
    <rule name= "WordPress rule 3" stopprocessing= "true" >
    <match url= "^ ([_0-9a-za-z-]+/)? wp-admin$" ignorecase= "false"/>
    <action type= "Redirect" url= "{r:1}wp-admin/" redirecttype= "Permanent"/>
    </rule>
    <rule name= "WordPress rule 4" stopprocessing= "true" >
    <match url= "^" ignorecase= "false"/>
    <conditions logicalgrouping= "Matchany" >
    <add input= "{request_filename}" matchtype= "Isfile" ignorecase= "false"/>
    <add input= "{request_filename}" matchtype= "Isdirectory" ignorecase= "false"/>
    </conditions>
    <action type= "None"/>
    </rule>
    <rule name= "WordPress rule 5" stopprocessing= "true" >
    <match url= "(^[_0-9a-za-z-]+/)? (wp-(content|admin|includes). *) "ignorecase=" false "/>
    <action type= "Rewrite" url= "{r:2}"/>
    </rule>
    <rule name= "WordPress rule 6" stopprocessing= "true" >
    <match url= "^ ([_0-9a-za-z-]+/)? (. *\.php) $ "ignorecase=" false "/>
    <action type= "Rewrite" url= "{r:2}"/>
    </rule>
    <rule name= "WordPress rule 7" stopprocessing= "true" >
    <match url= "." Ignorecase= "false"/>
    <action type= "Rewrite" url= "index.php"/>
    </rule>
    </rules>
    </rewrite>

    The modification of Web. config is for the Azure Web server hosting wordpress, the above content is some URL rewrite rules, WordPress gives the configuration in the use of directory mode is not working properly, so please be sure to use the code given in this article.

    Note: You need to modify only the content of the configuration section, please keep other content, such as

  3. Make a multi-site configuration, complete the above configuration, and log in from the new. You will notice that the top menu has changed, please clickMy Sites | Network Admin | DashboardGo to the Multi-site management console.


    Multi-site management console logically, the root console is located on all of your child sites, and all future plugins/skins (theme) installations will need to be completed using this console, while the administration of the article/content will be done using the corresponding site's console. Now let's add our English site and clickSites | All Sitesmenu and click the Add New button in the Sites page


    In the Add New Site page, fill in the information of the website, the site address is the directory where your new site is located, followed by the name and administrator mailbox. Click the Add Site button to complete the operation.


    Finish and return to Sites | All Sites page, you will see now there are two sites out.

  4. The front desk opens the address of the two sites respectively, you will see the main station because the data was imported before, so the article will be more, and the new sub-station only Hello World this piece of article


Here, we have completed the multi-site upgrade operation. In the next section (3.2), we will make different language configurations for 2 sites and install a multi-language switch plug-in to link two sites together.

Please pay attention to the public number Anb-io, weekly push content, have the technology also has the life, together to make a sentimental program ape.


Quick Create Site 3.2 WordPress multi-site and Azure online editor-Throw away your FTP tool, modify code all in the cloud

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.