标签为 iis 的存档

WordPress URL Rewrite

WordPress URL Rewrite 在 windows IIS下最完美的解决方案。
这种方法适合能自己管理服务器或者和你的空间商搞好关系,要他们帮你安装个免费的ISAPI扩展插件,直接就可以使用 WordPress 的永久固定链接。
ISAPI插件地址:http://www.binaryfortress.com/wordpress-url-rewrite/
IIS下演示 看: http://blog.tensay.com

使用的是www.wangku.org 的美国服务器 网酷美国主机 美国空间完美支持 wordpress

Isapi_rewrite和iirf都用这个规则就可以。

[ISAPI_Rewrite]

##### NOTE: Replace /shop/ with the relative web path of your catalog in the “Rewrite Base” line below:

Options +FollowSymLinks
Options FollowSymLinks
AllowOverride All
RewriteEngine On
RewriteBase /

# From Ultimate SEO URLs
RewriteRule ^(.*)-p-(.*).html /index.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-c-(.*).html /index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-m-([0-9]+).html /index.php?main_page=index&manufacturers_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pi-([0-9]+).html /index.php?main_page=popup_image&pID=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pr-([0-9]+).html /index.php?main_page=product_reviews&products_id=$2&%{QUERY_STRING} [L]
RewriteRule ^(.*)-pri-([0-9]+).html /index.php?main_page=product_reviews_info&products_id=$2&%{QUERY_STRING} [L]

# For Open Operations Info Manager
RewriteRule ^(.*)-i-([0-9]+).html /index.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L]

# For dreamscape’s News & Articles Manager
RewriteRule ^news/?$ index.php?main_page=news&%{QUERY_STRING} [L]
RewriteRule ^news/rss.xml /index.php?main_page=news_rss&%{QUERY_STRING} [L]
RewriteRule ^news/archive/? /index.php?main_page=news_archive&%{QUERY_STRING} [L]
RewriteRule ^news/([0-9]{4})-([0-9]{2})-([0-9]{2}).html /index.php?main_page=news&date=$1-$2-$3&%{QUERY_STRING} [L]
RewriteRule ^news/archive/([0-9]{4})-([0-9]{2}).html /index.php?main_page=news_archive&date=$1-$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+)-comments.html /index.php?main_page=news_comments&article_id=$2&%{QUERY_STRING} [L]
RewriteRule ^news/(.*)-a-([0-9]+).html /index.php?main_page=news_article&article_id=$2&%{QUERY_STRING} [L]

# All other pages
# Don’t rewrite real files or directories
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html /index.php?main_page=$1&%{QUERY_STRING} [L]

Drupal  (all versions)

RewriteCond %{HTTP_HOST} ^(www\.yourdomainname\.com).*$ [I]
RedirectRule ^/(.*)$ http://yourdomainname.com/$1 [I,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(?!favicon.ico$)([^?]*)(?:\?(.*))?$ /index.php?q=$1&$2 [L]

WordPress (all versions)

RewriteCond %{HTTP_HOST} ^(yourdomainname\.com).*$ [I]
RedirectRule ^/(.*)$ http://www.yourdomainname.com/$1 [I,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /index.php/$1 [L]

IIS下rewrite存在的主要问题还是中文分类和tag的问题,不是很好解决,上面的规则在英文站点下没有任何问题。

IIS下 wordpress也可以有完美的rewrite
包含三种常用永久链接规则:

  • /post/%post_id%.html
  • /%year%/%monthnum%/%day%/%postname%/
  • /%year%/%monthnum%/%day%/%postname%.html
  • iis下 isapi_rewrite的规则 (全文…)

    // Fix for IIS, which doesn't set REQUEST_URI
    if ( empty( $_SERVER['REQUEST_URI'] ) ) {

    // 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'];
    }
    }
    }

    或者这里 看里面的程序是这样写的
    可以参考这里来设置

    * Instructions: http://neosmart.net/blog/2006/100-apache-compliant-request_uri-for-iis-and-windows/
    * Support: http://neosmart.net/forums/forumdisplay.php?f=17
    * Product URI: http://neosmart.net/dl.php?id=7 (全文…)

    上了2台服务器,累了2天

    两台同时安装web服务,两台机器默认都没装iis,只好从网上下载,
    第一台先开始装,下载了个6M的iis,以后遇到6M的IIS一定不要下载,11M那个才是完整的。
    装这个6M的,中间就提示找不到文件了。中途又下载了个11M的,这样装完了,打开iis就500错误,肯定是权限问题,但是哪里的权限就对来对去不能确定了,给了所有的IIS_WPG、IUSR_用户等一堆权限,自己建立个站点算是正常,
    然后装plesk,这家伙也正常装完了,也可以正常配置,就是新建站点还是http500错误,打开进程池就挂起来了。
    把iis卸载了重装也不行,就是某个地方的用户权限少了一点。找了一晚上也没找出来真正原因.
    (全文…)

    现在我用的是IIRF 2.0(Ionics Isapi Rewrite Filter),2.1只出到测试版。
    搞了一晚上,一加载网站就不工作了。先搜集点资料,过几天单独弄个机器测试,感觉跟plesk有关系,影响筛选的加载,用isapi_rewrite也一样,单独添加dll文件的方式行不通,只能用安装文件。 (全文…)

    谁知道IIS中的这个错误信息提示:包含空格的项目的文件/路径部分需要用括号括起来
    是什么意思????

    应该怎么加空格解决???
    我给Isapi加了这样一个路径(C:\Program Files\isapi_redirect.dll),也就是C:\Program Files\中的Program Files中间有空格引起的。

    已解决,这样写:
    “C:\Program Files\isapi_redirect.dll”