• IIS7 php wordpress 中文url 标签tag中文URL404解决方法


    新建重写规则:

    <rule name="ChineseURL" stopProcessing="true">
        <match url="^(tag|category)/(.*)$" />
        <action type="Rewrite" url="chineseurl.php" />
    </rule>

    chineseurl.php如下:

    <?php
    // IIS Mod-Rewrite
    if (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {
        $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
    }
    // IIS Isapi_Rewrite
    else if (isset($_SERVER['HTTP_X_REWRITE_URL'])) {
        $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
    }
    else
    {
        // Use ORIG_PATH_INFO if there is no PATH_INFO
        if ( !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']) ) {
            if ( $_SERVER['PATH_INFO'] == $_SERVER['SCRIPT_NAME'] )
            $_SERVER['REQUEST_URI'] = $_SERVER['PATH_INFO'];
            else
            $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
        }
        // Append the query string if it exists and isn't null
        if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
            $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
        }
    }
    require("index.php");
    ?>

    结束。

  • 相关阅读:
    iOS面试题
    iOS-block
    iOS开发设计模式
    iOS-宏定义
    正则表达式(转)
    iOS-textfield控制光标开始位置
    initWithNibName&initWithCoder &awakeFromNib&UIView常见属性方法
    iOS应用生命周期
    iOS-app发布新版本步骤
    iOS从App跳转至系统设置菜单各功能项
  • 原文地址:https://www.cnblogs.com/1971ruru/p/3672831.html
Copyright © 2020-2023  润新知