一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

iis中wordpress 伪静态中文标签tag的设置

时间:2022-06-30 18:05:58 编辑:袖梨 来源:一聚教程网

通过增加一个 PHP 文件,并修改一下 Web.Config 文件中的 Rewrite 规则即可。

1、增加文件:cnurl.php ,内容为:

 代码如下 复制代码

// IIS Mod-Rewrite
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];} else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
// IIS Isapi_Rewrite
$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];} else {
// Use ORIG_PATH_INFO if there is no PATH_INFO
(!isset($_SERVER['PATH_INFO']) && isset($_SERVER['ORIG_PATH_INFO'])) && ($_SERVER['PATH_INFO'] = $_SERVER['ORIG_PATH_INFO']);
// Some IIS + PHP configurations puts the script-name in the path-info (No need to append it twice)
if (isset($_SERVER['PATH_INFO'])) {
($_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME']) ? ($_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO']) : ($_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO']);
}
// Append the query string if it exists and isn't null
(isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) && ($_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']);}require("index.php");?>

2、修改或建立 Web.Config 文件,内容为:

 代码如下 复制代码




 

 
 

WordPress" patternSyntax="Wildcard">
 

 
 

 

 


3、将 cnurl.php 和 Web.Config 上传至网站根目录即可

中文标签tag 404错误提示办法


 下面我们需要修改源文件(注:要养成习惯,修改源文件之前记得先备份该文件~)

1.打开wp-include文件夹,找到并打开编辑class-wp.php文件;

2.查找代码:

 代码如下 复制代码

$pathinfo = $_SERVER['PATH_INFO'];

把这句代码替换成:

$pathinfo = mb_convert_encoding($_SERVER['PATH_INFO'], "UTF-8", "GBK");

3.查找代码:

 代码如下 复制代码

$req_uri = $_SERVER['REQUEST_URI'];

把这句代码替换成:

$req_uri = mb_convert_encoding($_SERVER['REQUEST_URI'], "UTF-8", "GBK");


修改完成,保存,上传即可!

热门栏目