Put it in a subdirectory and the address displays the root directory
Put WordPress in a separate directory and display your blog in the root directory.
Many people want WordPress to drive their site's root directory (for example, http://example.com), but they don't want all
The WordPress files in the directory to mess up their root directories. WordPress allows you to put WordPress files in a sub-directory and
The blog is displayed in the root directory of the site.
Put WordPress in a separate directory. The program is as follows:
1. Create a new folder to store the WordPress core files (in this example, use/wordpress as an example ).
2. Go to the options panel.
3. Find the WordPress address (URL) option (for Chinese users, find "WordPress address (URL)"):
The address is changed to the folder address where you store WordPress files. For example: http://example.com/wordpress
4. Find the "Blog address (URL)" option: change this address to your website
The URL of the root directory. Example: http://example.com
5. Click Update Options ("Update settings" for Chinese users ").
6. Transfer the WordPress core file to the folder you created, that is, the WordPress address (URL) directory. Not yet
Understand? Specifically:/wordpress directory.
7. Transfer the index. php and. htaccess files from the WordPress directory to the root directory (that is, the Blog address.
8. Open and edit the "index. php" file in the root directory in a text editor.
9. Find the following code, modify and save it: find:
The code is as follows: |
Copy code |
1. require ('./wp-blog-header.php '); Change the address to the file in your WordPress Directory: 1. require ('./wordpress/wp-blog-header.php '); |
10, login control panel, the new control panel address for http://example.com/wordpress/wp-admin/
11. If you have set a structured link address (Permalinks), open the permanent link selection panel to update the Permalinks structure. If
If. htaccess has the correct permission settings, WordPress will automatically update your. htaccess file. If WordPress cannot be written to you
The. htaccess file will display the new rewrite rules, so you need to manually copy the rewrite rules to the. htaccess file
(Same as index. php ).
Put it in the root directory and the address displays the subdirectory
Install WordPress in the root directory but display the blog homepage in sub-directories, which is the opposite of the implementation of the previous tutorial. To implement
The premise is that your space must support the rewrite function. We can achieve this in two ways:
1. Refer to the method described in the previous article. I believe you already know that WordPress is installed in the root directory, and we will create a new one under the root directory.
Subdirectory, such as the "blog" directory. Transfer the index. php and. htaccess files in the root directory to the "blog" directory. In
Search in index. php:
The code is as follows: |
Copy code |
1. require ('./wp-blog-header.php '); To: 1. require ('../wp-blog-header.php '); |
Add a point to reference the files in the previous directory.
Other methods for changing the blog address and WordPress address are similar to those described in the previous article. Change the blog address:
Http://example.com/blog. change the page structure to "/blog/xxx... "Type.
2. The following method uses the page template related skills. Do you know nothing about page templates? Use WordPress static for boiled fish first
The template is fully charged! Don't forget to come back after the power is fully charged ~ Using page templates, we can even turn WordPress into a lightweight
Level CMS.
Create a new blog. php file and put it in the template directory used. This file contains the following content:
The code is as follows: |
Copy code |
1. <? Php 2 ./* 3. Template Name: Blog 4 .*/ 5.?> 6. 7. <? Php query_posts ('cat =-0 & prime;); // gets all posts 8. load_template (TEMPLATEPATH. '/index. Php'); // loads index 9.?>
|
Log on to the background, create a page, name it "blog", and use the "blog" page template. Make sure that the thumbnail name or
It is called a Data Domain and changed to "blog "!
The last step is to update the page structure to "/blog/xxx... "Type.