西部数码 linux主机 wordpress 重写规则httpd.conf

来源:互联网 发布:中学生机器人编程 编辑:程序博客网 时间:2024/05/21 06:59

西部数码的linux主机仍旧是无法直接使用htaccess,必须在控制面板开启 自定义重写,然后修改文件 /others/discuz/httpd.conf

整个文件内容如下:

RegistrationName= wlqcwinRegistrationCode= 2EAD-35GH-66NN-ZYBA[ISAPI_Rewrite]# 3600 = 1 hourCacheClockRate 3600RepeatLimit 32RewriteCond %{HTTP:Host} ^zbphp.com$RewriteRule (.*) http://www.zbphp.com$1 [NC,R=301]RewriteBase /RewriteCond %{REQUEST_URI} !^.*\.(css|js|gif|png|jpg|jpeg|xml)RewriteRule ^(?!index.php|wp-|xmlrpc)(.*)$ /chineseurl.php [I,L]

保存覆盖远程 /others/discuz/httpd.conf。然后将以下源码保存到wp根目录下,文件名为:chineseurl.php:

<?php//by www.zbphp.com// IIS Mod-Rewriteif (isset($_SERVER['HTTP_X_ORIGINAL_URL'])) {    $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];}// IIS Isapi_Rewriteelse 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");?>


0 0
原创粉丝点击