Windows host wordpress pseudo-static setting

  

Some time ago collect a pseudo-static method of wordpress permalink in a Windows IIS host, record it.

The prerequisite is that the server provider's control panel has the option to customize the 404 error page.

You only need to create a 404 error page, and write the following 4 lines of code to easily and elegantly implement the pseudo-static address format of the permanent fixed link of the windows iis host without plug-in. Remove the index.php from the web address.

<?php

$qs = $_SERVER['QUERY_STRING'];

$_SERVER['REQUEST_URI'] = Substr($qs, strpos($qs, ‘:80′)+3);

$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'];

include( ‘index.php’);

?>

This will fix the REQUEST_URI and PATH_INFO parameters and include index.php, and the rest will be handed over to WordPress to complete the task (to tell the truth) This parameter definition code is not clear, you can follow the gourd painting.

Specific steps:

1. Create a new notebook, write the above code, save it, and rename it to wp-404-handler.php with txt format.

2. Set 404 custom error to point to wp-404-handler.php. Generally speaking, most server control panels provide this option.

3. Enter the wordpress management background, set (Options) - Permalinks (Permalinks), you will be your own host is a Linux host to make it, arbitrary, casually set your favorite pseudo-static address format and static Address suffix.

4.Enjoy!

It is recommended that the link address level not be too deep, and the pseudo-static address plus html/htm, but it is also recommended not to add a pseudo-static suffix, because the search engine It may be considered that the address is a categorical directory, not a specific web page, so as to obtain a higher search ranking weight, and now the wordpress personal blog is also popular in the pseudo-static format.

This method cleverly uses the 404 error jump to achieve the same effect as pseudo-static, for friends who use windows host can be said to be a good thing!

Copyright © Windows knowledge All Rights Reserved