WordPress pseudo static under Windows host

Source: Internet
Author: User
Keywords WordPress

Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall

For most of the choice of WordPress station Webmaster, will choose the Linux host to build stations, but occasionally there will be a few people do not know the circumstances of the premise, chose the Windows host, which is undoubtedly a wrong choice. Then, since the choice of Windows host, you should solve most of the webmaster want to achieve the WordPress pseudo static problem. I sent the site long is to achieve this, I hope to help you.

For Windows host consumers, you find the wordprcess background > settings (Options) >> permalink (permalinks). Here, WordPress provides 6 options on the form of URL links, the first five options for the host is supported, do not require special treatment. Here I explain the sixth option, I provide the solution is through the custom 404 error page settings to achieve, relatively complex, please follow the steps to achieve, as far as possible to explain the details.

1. Now the local computer to create a 404.php file, it is recommended to use specialized PHP editing software, of course, you can also use Notepad. Copy, save, and upload the following code to the root directory of the space.

<?php
$qs = $_server[' query_string '];
$_server[' Request_uri ' = substr ($qs, Strpos ($qs, ': 80 ') +3);
$_server[' path_info '] = $_server[' Request_uri '];
Include (' index.php ');
?>

2. Login to your space control backstage, in the control Panel to find the "Custom error" option, due to the different space provider, this option will also be different, but the general effect is about 404 error page customization, specific can consult space business. Find the selection, the next is the file just uploaded to define the 404 error page, in fact, is not to define the site 404 error, but to provide this way to achieve the WordPress pseudo static.

3. Enter the website WordPress management Backstage, setting (Options) >> fixed link (permalinks), find "Custom structure". You can refer to the following custom format and choose a type that suits your liking. The most common one is/%post_id%.html, which is in the form of a link to the article ID number, in the form of/47.html this format; there is a/%postname%.html, which is a link to the name of the article, the effect is Title. html This form, if the article name is Chinese, will automatically convert to% symbol, if the server support is not very good, will not be able to access some server support is not good, inaccessible. The first type is recommended.

The attached official provides some of the following custom parameters:

%year% year
%monthnum% Month
%day% Date
%hour% hours
%minute% minutes
%second% seconds
%category% Directory
%author% author

4. This method often leads to Chinese tags and some related places tags can not be found, the solution is to replace the following code, find the following code in/wp-includes/class-wp.php:

if (isset ($_server[' path_info '))


$pathinfo = $_server[' path_info '];


Else


$pathinfo = ';


$pathinfo _array = Explode ('? ', $pathinfo);


$pathinfo = str_replace ("%", "%25", $pathinfo _array[0]);


$req _uri = $_server[' Request_uri '];

Replace with

if (isset ($_server[' path_info '))


$pathinfo = mb_convert_encoding ($_server[' path_info '), ' utf-8 ', ' GBK ');


Else


$pathinfo = ";


$pathinfo _array = explode ('? ', $pathinfo);


$pathinfo = str_replace ("%", "%25", $pathinfo _array[0]);


$req _uri = mb_convert_encoding ($_server[' Request_uri '), ' utf-8 ', ' GBK ');

Well, you can be very proud to view the front of your site, you will find that the site URL did achieve static, the original is so simple. (⊙o⊙). If you encounter in the configuration do not understand the place, you can ask me, a common progress.

This article is from: My network wordpress tutorial http://www.olpie.com, reprint please indicate the original link address: http://www.olpie.com/1069.html

Related Article

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.