iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

用于收藏精华贴子、网友共享的资料等。可以回复,不能发新贴。

版主: Jack

版面规则
本版面不能发新贴,可以回复

iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子yeemn » 2006-06-09 6:17

iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

方法A.模块插件式安装,后台可以控制开关。
一..首先安装ISAPI_Rewrite FOR IIS6,用IIS支持REWRITE模块,最新的版本是2.8在这里下载:

ISAPI_Rewrite2.8下载地址

不管哪个版本的ZENCART要让IIS实现REWRITE这个是必装的,下完后安装文件是.MIS文件,直接默认安装就可以了.完成后重新启动IIS.

二.安装Ultimate SEO URLs 2.101 for Zen Cart1.3.01/安装Ultimate SEO URLs 2.100 for Zen Cart1.2.7

Ultimate SEO URLs 2.101 下载地址for Zen Cart1.3.01
Ultimate SEO URLs 2.100 下载地址for Zen Cart1.2.7



For this v1.3.0-compatible version, follow the installation instructions at the URL below, (1.3.0版本相对1.2.X的步骤稍有不同)
BUT WITH THE FOLLOWING EXCEPTIONS:
1. skip step #2 ... editing application_top.php(参照安装帮助跳过第2步。)
2. steps 3-5, already-edited versions of these files are in the "1301_specific_files" folder. (第3到第5步的文件修改已经包含在1301_specific_files文件夹中)
Simply upload these to the related folder on your site. You should rename the existing file to *.bak before copying.(上传前请务必先保存文件为*.BAK)
3. step 6 ... a sample .htaccess file is included. Simply rename to .htaccess and edit the word /shop/ to match your stie(第6步中的.htaccess文件中的内容如果站点在根目录也不用修改)。

安装详细步骤连接参考
INSTALLATION INSTRUCTIONS:
http://www.dream-scape.com/pub/zencart/Ultimate_SEO_URLs/install.html

三.取消ISAPI_Rewrite安装目录中的httpd.ini只读属性,然后编写规则

直接把第二步中的.htaccess文件中的内容复制过来.

关键的步骤到了,这也是IIS和APC下的不同

第一: ?改为\?

第二:表示转换符号的 $+空格 改为 空格+/ 这也是我上一次测试没成的原因,这个很关键.
大家可以直接拿.htaccess文件来改

1.3.01规则
代码: 全选
[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]


1.2.7规则
代码: 全选
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

# OLD SEO URLS
# Give a 301 to real URL (which Ultimate SEO will give a 301 to new SEO URL)
# You can remove the following if you were not using the breakmyzencart.com SEFU prior to installing this one
# BEGIN SAFE REMOVE
RewriteRule ^(.*)pages-main/category-(.*)/page-([0-9]+)/sort-(.*)/(.*).html index.php?main_page=index&cPath=$2&page=$3&sort=$4&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-main/category-(.*)/(.*).html index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-productinfo/category-(.*)/product-(.*)/(.*).html index.php?main_page=product_info&cPath=$2&products_id=$3&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-productinfo/product-(.*)/(.*).html index.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-product_reviews_info/product-(.*)/reviews_id-([0-9]+)/(.*).html index.php?main_page=product_reviews_info&products_id=$2&reviews_id=$3&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-info_manager/pages_id-([0-9]+)/(.*).html index.php?main_page=info_manager&pages_id=$2&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-product_music_info/product-(.*)/(.*).html index.php?main_page=product_music_info&products_id=$2&%{QUERY_STRING} [L,R=301]
RewriteRule ^(.*)pages-(.*)/index.html index.php?main_page=$2&%{QUERY_STRING} [L,R=301]
# END SAFE REMOVE

# 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]
RewriteRule ^(.*)-pmi-([0-9]+).html$ index.php?main_page=product_music_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]


方法B.修改部分文件,暂时只适用于1.2.7
http://www.intaa.net/~gato/zencart_user_friendly_urls/

一。修改/includes/configure.php.
追加红色部分
define('USE_PCONNECT', 'true'); // use persistent connections? or false
define('STORE_SESSIONS', 'db'); // leave empty '' for default handler or set to 'db'

define('USER_FRIENDLY_URLS_REWRITE', 'true');

二。修改/includes/functions/html_output.php
代码: 全选
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce                                       |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 The zen-cart developers                           |
// |                                                                      |
// | http://www.zen-cart.com/index.php                                    |
// |                                                                      |
// | Portions Copyright (c) 2003 osCommerce                               |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license,       |
// | that is bundled with this package in the file LICENSE, and is        |
// | available through the world-wide-web at the following url:           |
// | http://www.zen-cart.com/license/2_0.txt.                             |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to       |
// | license@zen-cart.com so we can mail you a copy immediately.          |
// +----------------------------------------------------------------------+
// $Id: html_output.php 1631 2005-07-24 19:29:52Z drbyte $
//
/**
 * @package ZenCart_Functions
*/

////
// The HTML href link wrapper function
  function zen_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true, $static = false, $use_dir_ws_catalog = true) {
    global $request_type, $session_started, $http_domain, $https_domain;

    if (!zen_not_null($page)) {
      die('</td></tr></table></td></tr></table><br /><br /><strong class="note">Error!<br /><br />Unable to determine the page link!</strong><br /><br />');
    }

    if ($connection == 'NONSSL') {
      $link = HTTP_SERVER;
    } elseif ($connection == 'SSL') {
      if (ENABLE_SSL == 'true') {
        $link = HTTPS_SERVER ;
      } else {
        $link = HTTP_SERVER;
      }
    } else {
      die('</td></tr></table></td></tr></table><br /><br /><strong class="note">Error!<br /><br />Unable to determine connection method on a link!<br /><br />Known methods: NONSSL SSL</strong><br /><br />');
    }

    if ($use_dir_ws_catalog) $link .= DIR_WS_CATALOG;

    if (!$static) {
      if (zen_not_null($parameters)) {
    if ((USER_FRIENDLY_URLS_REWRITE == 'true') &&
        (!ereg('language', $parameters)) &&
        (!ereg('manufacturers_id', $parameters)) &&
        (!ereg('contact_us', $page)) &&
        (!ereg('review', $page)) &&
        (!ereg('review', $parameters))
       ) {

      $parameters = str_replace('&sort=', '/sort', $parameters);
      $parameters = str_replace('&page=', '/page', $parameters);
      $parameters = str_replace('&filter_id=', '/filter', $parameters);
      $parameters = str_replace('disp_order=', 'display', $parameters);

      if (($page == "index") && (ereg('cPath', $parameters))){
        $cnum = str_replace('cPath=', 'cid', $parameters);
        $parameters = str_replace("cPath=", "categories/", $parameters);   
        $link .= $parameters . '.html';
        require("url_data.php");
        if ($urlrpl[$cnum] != NULL) {
            $link = ereg_replace("categories/[0-9_]{1,}", "categories/$urlrpl[$cnum]", $link);
        }
      }

          elseif (($page == "product_info") && (ereg('products_id', $parameters))){
        $pnum = str_replace('products_id=', 'pid', $parameters);
        $pnum = ereg_replace('cPath=[0-9_]{1,}&', '', $pnum);
        $parameters = str_replace("products_id=", "products/", $parameters);
        $parameters = ereg_replace('cPath=([0-9_]{1,})&', '', $parameters);
        $parameters = str_replace('action=notify&','notify', $parameters);
        $parameters = str_replace('action=add_product&','add', $parameters);
        $parameters = str_replace('&reviews_id=','review/', $parameters);
        $parameters = str_replace('&action=notify_remove','notify_remove', $parameters);
        $parameters = str_replace('&action=notify','notify', $parameters);
        $link .= $parameters . '.html';
        require("url_data.php");
        if ($urlrpl[$pnum] != NULL) {
            $link = ereg_replace("products/[0-9]{1,}", "products/$urlrpl[$pnum]", $link);
        }
      }

      elseif ($page == 'redirect') {
        if (ereg('banner', $parameters)){
        $parameters = str_replace('action=banner&goto=', 'redirect_banner', $parameters);
        $link .= $parameters . '.html';
        }
        if (ereg('url', $parameters)){
        $parameters = str_replace('action=url&goto=', 'redirect_url/', $parameters);
        $parameters = str_replace('%2F', '/', $parameters);
        $link = $parameters;
        }
      }

      elseif ($page == 'tell_a_friend') {
        $parameters = str_replace('to_email_address=','/to_', $parameters);
        $parameters = str_replace('products_id=','/products', $parameters);
        $parameters = str_replace('action=process&','/send', $parameters);
        $link .= $page . $parameters . '.html';
      }

          elseif (
             ($page == "products_all") or
        ($page == "products_new") or
        ($page == "featured_products") or
        ($page == "specials)")
          ){

         $link .= $page ."/" . $parameters . '.html';
          } else {

            $link .= 'index.php?main_page='. $page . "&" . zen_output_string($parameters);


    }   

    } else {
        $link .= 'index.php?main_page='. $page . "&" . zen_output_string($parameters);
    }
      } else {
    if (USER_FRIENDLY_URLS_REWRITE == 'true') {
          if (
                ($page == 'login') or
                ($page == 'advanced_search') or
                ($page == 'specials') or
                ($page == 'featured_products') or
                ($page == 'products_new') or
                ($page == 'products_all') or
                ($page == 'shippinginfo') or
                ($page == 'privacy') or
                ($page == 'conditions') or
                ($page == 'contact_us') or
                ($page == 'gv_faq') or
                ($page == 'site_map') or
                ($page == 'logoff') or
                ($page == 'account') or
                ($page == 'shopping_cart') or
                ($page == 'popup_shipping_estimator') or
                ($page == 'news_manager_all_news') or
                ($page == 'unsubscribe') or
                ($page == 'reviews') or
                ($page == 'checkout_shipping')
              ){
                        $link .= $page . ".html";
        } else {
        $link .= 'index.php?main_page=' . $page;
            }
        } else {
        $link .= 'index.php?main_page=' . $page;
        }
    }
    } else {
      if (zen_not_null($parameters)) {
        $link .= $page . "?" . zen_output_string($parameters);
      } else {
        $link .= $page;
      }
    }


    $separator = '&';

    while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);
// Add the session ID when moving from different HTTP and HTTPS servers, or when SID is defined
    if ( ($add_session_id == true) && ($session_started == true) && (SESSION_FORCE_COOKIE_USE == 'False') ) {
      if (defined('SID') && zen_not_null(SID)) {
        $sid = SID;
//      } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL_ADMIN == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {
      } elseif ( ( ($request_type == 'NONSSL') && ($connection == 'SSL') && (ENABLE_SSL == 'true') ) || ( ($request_type == 'SSL') && ($connection == 'NONSSL') ) ) {


        if ($http_domain != $https_domain) {
          $sid = zen_session_name() . '=' . zen_session_id();
        }
      }
    }

// clean up the link before processing
    while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);
    while (strstr($link, '&amp;&amp;')) $link = str_replace('&amp;&amp;', '&amp;', $link);

    if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {
      while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);

      $link = str_replace('&amp;', '/', $link);
      $link = str_replace('?', '/', $link);
      $link = str_replace('&', '/', $link);
      $link = str_replace('=', '/', $link);

      $separator = '?';
    }

    if (isset($sid)) {
      $link .= $separator . $sid;
    }

// clean up the link after processing
    while (strstr($link, '&amp;&amp;')) $link = str_replace('&amp;&amp;', '&amp;', $link);

    $link = ereg_replace('&', '&amp;', $link);
    return $link;
  }


// use when proportional images is turned off or from a template directory
////
// The HTML image wrapper function
  function zen_image_OLD($src, $alt = '', $width = '', $height = '', $parameters = '') {
    global $template_dir;

//auto replace with defined missing image
    if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
      $src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
    }

    if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
      return false;
    }

    // if not in current template switch to template_default
    if (!file_exists($src)) {
      $src = str_replace(DIR_WS_TEMPLATES . $template_dir, DIR_WS_TEMPLATES . 'template_default', $src);
    }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
    $image = '<img src="' . zen_output_string($src) . '" border="0" alt="' . zen_output_string($alt) . '"';

    if (zen_not_null($alt)) {
      $image .= ' title=" ' . zen_output_string($alt) . ' "';
    }

    if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
      if ($image_size = @getimagesize($src)) {
        if (empty($width) && zen_not_null($height)) {
          $ratio = $height / $image_size[1];
          $width = $image_size[0] * $ratio;
        } elseif (zen_not_null($width) && empty($height)) {
          $ratio = $width / $image_size[0];
          $height = $image_size[1] * $ratio;
        } elseif (empty($width) && empty($height)) {
          $width = $image_size[0];
          $height = $image_size[1];
        }
      } elseif (IMAGE_REQUIRED == 'false') {
        return false;
      }
    }

    if (zen_not_null($width) && zen_not_null($height)) {
      $image .= ' width="' . zen_output_string($width) . '" height="' . zen_output_string($height) . '"';
    }

    if (zen_not_null($parameters)) $image .= ' ' . $parameters;

    $image .= ' />';

    return $image;
  }


////
// The HTML image wrapper function
  function zen_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
    global $template_dir;

    // soft clean the alt tag
    $alt = zen_clean_html($alt);

    // use old method on template images
    if (strstr($src, 'includes/templates') or strstr($src, 'includes/languages') or PROPORTIONAL_IMAGES_STATUS == '0') {
      return zen_image_OLD($src, $alt, $width, $height, $parameters);
    }

//auto replace with defined missing image
    if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
      $src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
    }

    if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
      return false;
    }

    // if not in current template switch to template_default
    if (!file_exists($src)) {
      $src = str_replace(DIR_WS_TEMPLATES . $template_dir, DIR_WS_TEMPLATES . 'template_default', $src);
    }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
    $image = '<img src="' . zen_output_string($src) . '" border="0" alt="' . zen_output_string($alt) . '"';

    if (zen_not_null($alt)) {
      $image .= ' title=" ' . zen_output_string($alt) . ' "';
    }

    if ( ((CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height))) ) {
      if ($image_size = @getimagesize($src)) {
        if (empty($width) && zen_not_null($height)) {
          $ratio = $height / $image_size[1];
          $width = $image_size[0] * $ratio;
        } elseif (zen_not_null($width) && empty($height)) {
          $ratio = $width / $image_size[0];
          $height = $image_size[1] * $ratio;
        } elseif (empty($width) && empty($height)) {
          $width = $image_size[0];
          $height = $image_size[1];
        }
      } elseif (IMAGE_REQUIRED == 'false') {
        return false;
      }
    }


    if (zen_not_null($width) && zen_not_null($height) and file_exists($src)) {
//      $image .= ' width="' . zen_output_string($width) . '" height="' . zen_output_string($height) . '"';
// proportional images
      $image_size = @getimagesize($src);
      // fix division by zero error
      $ratio = ($image_size[0] != 0 ? $width / $image_size[0] : 1);
      if ($image_size[1]*$ratio > $height) {
        $ratio = $height / $image_size[1];
        $width = $image_size[0] * $ratio;
      } else {
        $height = $image_size[1] * $ratio;
      }

      $image .= ' width="' . $width . '" height="' . $height . '"';
    } else {
       // override on missing image to allow for proportional and required/not required
      if (IMAGE_REQUIRED == 'false') {
        return false;
      } else {
        $image .= ' width="' . SMALL_IMAGE_WIDTH . '" height="' . SMALL_IMAGE_HEIGHT . '"';
      }
    }

    if (zen_not_null($parameters)) $image .= ' ' . $parameters;

    $image .= ' />';

    return $image;
  }

////
// The HTML form submit button wrapper function
// Outputs a button in the selected language
  function zen_image_submit($image, $alt = '', $parameters = '') {
    global $template, $current_page_base;

    $image_submit = '<input type="image" src="' . zen_output_string($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image) . '" alt="' . zen_output_string($alt) . '"';

    if (zen_not_null($alt)) $image_submit .= ' title=" ' . zen_output_string($alt) . ' "';

    if (zen_not_null($parameters)) $image_submit .= ' ' . $parameters;

    $image_submit .= ' />';

    return $image_submit;
  }

////
// Output a function button in the selected language
  function zen_image_button($image, $alt = '', $parameters = '') {
    global $template, $current_page_base;

    return zen_image($template->get_template_dir($image, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/') . $image, $alt, '', '', $parameters);
  }

////
// Output a separator either through whitespace, or with an image
  function zen_draw_separator($image = 'true', $width = '100%', $height = '1') {

    // set default to use from template - zen_image will translate if not found in current template
    if ($image == 'true') {
      $image = DIR_WS_TEMPLATE_IMAGES . OTHER_IMAGE_BLACK_SEPARATOR;
    } else {
      if (!strstr($image, DIR_WS_TEMPLATE_IMAGES)) {
        $image = DIR_WS_TEMPLATE_IMAGES . $image;
      }
    }
    return zen_image($image, '', $width, $height);
  }

////
// Output a form
  function zen_draw_form($name, $action, $method = 'post', $parameters = '') {
    $form = '<form name="' . zen_output_string($name) . '" action="' . zen_output_string($action) . '" method="' . zen_output_string($method) . '"';

    if (zen_not_null($parameters)) $form .= ' ' . $parameters;

    $form .= '>';

    return $form;
  }

////
// Output a form input field
  function zen_draw_input_field($name, $value = '', $parameters = '', $type = 'text', $reinsert_value = true) {
    $field = '<input type="' . zen_output_string($type) . '" name="' . zen_output_string($name) . '"';

    if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
      $field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
    } elseif (zen_not_null($value)) {
      $field .= ' value="' . zen_output_string($value) . '"';
    }

    if (zen_not_null($parameters)) $field .= ' ' . $parameters;

    $field .= ' />';

    return $field;
  }

////
// Output a form password field
  function zen_draw_password_field($name, $value = '', $parameters = 'maxlength="40"') {
    return zen_draw_input_field($name, $value, $parameters, 'password', true);
  }

////
// Output a selection field - alias function for zen_draw_checkbox_field() and zen_draw_radio_field()
  function zen_draw_selection_field($name, $type, $value = '', $checked = false, $parameters = '') {
    $selection = '<input type="' . zen_output_string($type) . '" name="' . zen_output_string($name) . '"';

    if (zen_not_null($value)) $selection .= ' value="' . zen_output_string($value) . '"';

    if ( ($checked == true) || ( isset($GLOBALS[$name]) && is_string($GLOBALS[$name]) && ( ($GLOBALS[$name] == 'on') || (isset($value) && (stripslashes($GLOBALS[$name]) == $value)) ) ) ) {
      $selection .= ' checked="checked"';
    }

    if (zen_not_null($parameters)) $selection .= ' ' . $parameters;

    $selection .= ' />';

    return $selection;
  }

////
// Output a form checkbox field
  function zen_draw_checkbox_field($name, $value = '', $checked = false, $parameters = '') {
    return zen_draw_selection_field($name, 'checkbox', $value, $checked, $parameters);
  }

////
// Output a form radio field
  function zen_draw_radio_field($name, $value = '', $checked = false, $parameters = '') {
    return zen_draw_selection_field($name, 'radio', $value, $checked, $parameters);
  }

////
// Output a form textarea field
  function zen_draw_textarea_field($name, $wrap, $width, $height, $text = '', $parameters = '', $reinsert_value = true) {
    $field = '<textarea name="' . zen_output_string($name) . '" wrap="' . zen_output_string($wrap) . '" cols="' . zen_output_string($width) . '" rows="' . zen_output_string($height) . '"';

    if (zen_not_null($parameters)) $field .= ' ' . $parameters;

    $field .= '>';

    if ( (isset($GLOBALS[$name])) && ($reinsert_value == true) ) {
      $field .= stripslashes($GLOBALS[$name]);
    } elseif (zen_not_null($text)) {
      $field .= $text;
    }

    $field .= '</textarea>';

    return $field;
  }

////
// Output a form hidden field
  function zen_draw_hidden_field($name, $value = '', $parameters = '') {
    $field = '<input type="hidden" name="' . zen_output_string($name) . '"';

    if (zen_not_null($value)) {
      $field .= ' value="' . zen_output_string($value) . '"';
    } elseif (isset($GLOBALS[$name])) {
      $field .= ' value="' . zen_output_string(stripslashes($GLOBALS[$name])) . '"';
    }

    if (zen_not_null($parameters)) $field .= ' ' . $parameters;

    $field .= ' />';

    return $field;
  }

////
// Output a form file-field
  function zen_draw_file_field($name, $required = false) {
    $field = zen_draw_input_field($name, '', ' size="50" ', 'file');

    return $field;
  }


////
// Hide form elements
  function zen_hide_session_id() {
    global $session_started;

    if ( ($session_started == true) && defined('SID') && zen_not_null(SID) ) {
      return zen_draw_hidden_field(zen_session_name(), zen_session_id());
    }
  }

////
// Output a form pull down menu
  function zen_draw_pull_down_menu($name, $values, $default = '', $parameters = '', $required = false) {
    $field = '<select name="' . zen_output_string($name) . '"';

    if (zen_not_null($parameters)) $field .= ' ' . $parameters;

    $field .= '>';

    if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

    for ($i=0, $n=sizeof($values); $i<$n; $i++) {
      $field .= '<option value="' . zen_output_string($values[$i]['id']) . '"';
      if ($default == $values[$i]['id']) {
        $field .= ' selected="selected"';
      }

      $field .= '>' . zen_output_string($values[$i]['text'], array('"' => '"', ''' => ''', '<' => '<', '>' => '>')) . '</option>';
    }
    $field .= '</select>';

    if ($required == true) $field .= TEXT_FIELD_REQUIRED;

    return $field;
  }

////
// Creates a pull-down list of countries
  function zen_get_country_list($name, $selected = '', $parameters = '') {
    $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT));
    $countries = zen_get_countries();

    for ($i=0, $n=sizeof($countries); $i<$n; $i++) {
      $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']);
    }

    return zen_draw_pull_down_menu($name, $countries_array, $selected, $parameters);
  }
?>


规则
代码: 全选
RewriteEngine on
RewriteBase /

RewriteRule ^categories/Hardware.html /index.php?main_page=index&cPath=1 [L]
RewriteRule ^categories/Graphics_Cards.html /index.php?main_page=index&cPath=1_4 [L]
RewriteRule ^categories/Keyboards.html /index.php?main_page=index&cPath=1_8 [L]
RewriteRule ^categories/Mice.html /index.php?main_page=index&cPath=1_9 [L]
RewriteRule ^products/Matrox_G200_MMS.html /index.php?main_page=product_info&products_id=1 [L]
RewriteRule ^products/Microsoft_Internet_Keyboard_PS2.html /index.php?main_page=product_info&products_id=25 [L]
RewriteRule ^products/Microsoft_IntelliMouse_Explorer.html /index.php?main_page=product_info&products_id=26 [L]

RewriteRule ^products/(.*)notify_remove.html /index.php?main_page=product_info&products_id=$1&action=notify_remove [L]
RewriteRule ^products/(.*)notify.html /index.php?main_page=product_info&products_id=$1&action=notify [L]
RewriteRule ^products/(.*)add.html /index.php?main_page=product_info&products_id=$1&action=add_product [L]
RewriteRule ^products/(.*).html /index.php?main_page=product_info&products_id=$1 [L]
RewriteRule ^categories/(.*)/filter(.*)/page(.*)/sort(.*).html /index.php?main_page=index&cPath=$1&filter_id=$2&page=$3&sort=$4 [L]
RewriteRule ^categories/(.*)/sort(.*)/filter(.*)/page(.*).html /index.php?main_page=index&cPath=$1&sort=$2&filter_id=$3&page=$4 [L]
RewriteRule ^categories/(.*)/filter(.*)/sort(.*)/page(.*).html /index.php?main_page=index&cPath=$1&filter_id=$2&sort=$3&page=$4 [L]
RewriteRule ^categories/(.*)/sort(.*)/filter(.*).html /index.php?main_page=index&cPath=$1&sort=$2&filter_id=$3 [L]
RewriteRule ^categories/(.*)/sort(.*)/page(.*).html /index.php?main_page=index&cPath=$1&sort=$2&page=$3 [L]
RewriteRule ^categories/(.*)/page(.*)/sort(.*).html /index.php?main_page=index&cPath=$1&page=$2&sort=$3 [L]
RewriteRule ^categories/(.*).html /index.php?main_page=index&cPath=$1 [L]
RewriteRule ^order/(.*).html /index.php?main_page&action=buy_now&products_id=$1 [L]
RewriteRule ^(.*)/display(.*)/page(.*).html /index.php?main_page=$1&disp_order=$2&page=$3 [L]
RewriteRule ^shippinginfo.html /index.php?main_page=shippinginfo [L]
RewriteRule ^privacy.html /index.php?main_page=privacy [L]
RewriteRule ^conditions.html /index.php?main_page=conditions [L]
RewriteRule ^contact_us.html /index.php?main_page=contact_us [L]
RewriteRule ^gv_faq.html /index.php?main_page=gv_faq [L]
RewriteRule ^specials.html /index.php?main_page=specials [L]
RewriteRule ^featured_products.html /index.php?main_page=featured_products [L]
RewriteRule ^products_new.html /index.php?main_page=products_new [L]
RewriteRule ^products_all.html /index.php?main_page=products_all [L]
RewriteRule ^tell_a_friend/to_(.*)/products(.*).html /index.php?main_page=tell_a_friend&to_email_address=$1&products_id=$2 [L]
RewriteRule ^tell_a_friend/send/products(.*).html /index.php?main_page=tell_a_friend&action=process&products_id=$1 [L]
RewriteRule ^tell_a_friend/products(.*).html /index.php?main_page=tell_a_friend&products_id=$1 [L]
RewriteRule ^manufacturers_id(.*).html /index.php?main_page=index&manufacturers_id=$1 [L]
RewriteRule ^redirect/manufacturers_id(.*).html /index.php?main_page=redirect&action=manufacturer&manufacturers_id=$1 [L]
RewriteRule ^redirect_banner(.*).html /index.php?main_page=redirect&action=banner&goto=$1 [L]
RewriteRule ^redirect_url/(.*) /index.php?main_page=redirect&action=url&goto=$1 [L]
RewriteRule ^login.html /index.php?main_page=login [L]
RewriteRule ^logoff.html /index.php?main_page=logoff [L]
RewriteRule ^account.html /index.php?main_page=account [L]
RewriteRule ^shopping_cart.html /index.php?main_page=shopping_cart [L]
RewriteRule ^checkout_shipping.html /index.php?main_page=checkout_shipping [L]
RewriteRule ^advanced_search.html /index.php?main_page=advanced_search [L]
RewriteRule ^popup_shipping_estimator.html /index.php?main_page=popup_shipping_estimator [L]
RewriteRule ^news/(.*).html /index.php?main_page=news_manager&pages_id=$1 [L]
RewriteRule ^news_manager_all_news.html /index.php?main_page=news_manager_all_news [L]
RewriteRule ^unsubscribe.html /index.php?main_page=unsubscribe [L]
RewriteRule ^reviews.html /index.php?main_page=reviews [L]
RewriteRule ^index.html$ /index.php?main_page=index [L]



最后注意html_output.php的修改
其中有类似'index.php?main_page这样的语句,“?”号都要加“\”这样就不会出现不能注册的了
心静/思远/志在千里

头像
yeemn
高级会员
高级会员
 
帖子: 270
注册: 2006-02-22 19:53

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子jlbsun2008 » 2006-06-09 10:52

谢谢斑竹啊
www.haosail.com
浩 赛 饰 品 城
jlbsun2008
高级会员
高级会员
 
帖子: 184
注册: 2006-03-12 13:15
地址: 浙江

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子jlbsun2008 » 2006-06-09 12:52

抱歉 我用的方法A
首先我装了这个插件.模块插件式安装. 因为没有导入SQL还是什么的,我后台没有可以控制开关.

其次,我是按照http://www.dream-scape.com/pub/zencart/Ultimate_SEO_URLs/install.html
来安装的. 就最后那个.htaccess 我是复制斑竹的 1.2.7规则 里面的代码!
我是直接的空间上调试的,httpd.ini 这个文件不知道是否我加的,.为保险 我在根目录加了这个文件 然后把.htaccess 复制到这个文件里.
经过这样一步步下来,我打开首页 首页链接是的确生成HTM 但是点进去都是错误的!

您说的 ?改为\? $+空格 改为 空格+/ 这些你应该已经在本贴改好了. 其他的一些地方 比如

admin/categories.php 下的: $action = (isset($_GET['action']) ? $_GET['action'] : '');
是否也要这样做呢?

希望斑竹能给个联系方式

我先给了 QQ157408677
www.haosail.com
浩 赛 饰 品 城
jlbsun2008
高级会员
高级会员
 
帖子: 184
注册: 2006-03-12 13:15
地址: 浙江

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子jlbsun2008 » 2006-06-26 0:30

第一种方法没有成功
第二种方法失败
错误如下:
Parse error: parse error, expecting `')'' in F:\webhost\haosail_s43rrqiw\www\includes\functions\html_output.php on line 533
www.haosail.com
浩 赛 饰 品 城
jlbsun2008
高级会员
高级会员
 
帖子: 184
注册: 2006-03-12 13:15
地址: 浙江

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子骄阳 » 2008-12-11 11:32

jlbsun2008 写道:抱歉 我用的方法A
首先我装了这个插件.模块插件式安装. 因为没有导入SQL还是什么的,我后台没有可以控制开关.

其次,我是按照http://www.dream-scape.com/pub/zencart/Ultimate_SEO_URLs/install.html
来安装的. 就最后那个.htaccess 我是复制斑竹的 1.2.7规则 里面的代码!
我是直接的空间上调试的,httpd.ini 这个文件不知道是否我加的,.为保险 我在根目录加了这个文件 然后把.htaccess 复制到这个文件里.
经过这样一步步下来,我打开首页 首页链接是的确生成HTM 但是点进去都是错误的!

您说的 ?改为\? $+空格 改为 空格+/ 这些你应该已经在本贴改好了. 其他的一些地方 比如

admin/categories.php 下的: $action = (isset($_GET['action']) ? $_GET['action'] : '');
是否也要这样做呢?

希望斑竹能给个联系方式

我先给了 QQ157408677

问题同此
SEO高手,大家互补也行!replica watches - tiffany jewelry合作亦可~
骄阳
新手上路
新手上路
 
帖子: 19
注册: 2008-11-20 11:43

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子lookupsee » 2009-05-11 12:31

topic1280.html
三.取消ISAPI_Rewrite安装目录中的httpd.ini只读属性,然后编写规则
直接把第二步中的.htaccess文件中的内容复制过来.
关键的步骤到了,这也是IIS和APC下的不同
第一: ?改为\?
第二:表示转换符号的 $+空格 改为 空格+/ 这也是我上一次测试没成的原因,这个很关键.
大家可以直接拿.htaccess文件来改

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

Options +FollowSymLinks
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]

现在我有2个问题需要确认:
1》?改为\? 这个地方 是 修改 为\? 还是/? .htaccess 这个文件里都找不到一个\ 这样的字符, 都全是/ 这样的, 所以不清楚 这个问题
2》表示转换符号的 $+空格 改为 空格+/ .htaccess 这个文件里都找不到一个$+空格 的地方, 所以很 郁闷
lookupsee
普通会员
普通会员
 
帖子: 22
注册: 2009-04-24 6:52

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子chenzongqp » 2009-06-09 8:26

那1.38的呢,怎么实现这样的一个功能呀!
网粽之家~网衣之家男女服装购物网
http://www.wzzhome.com
chenzongqp
新手上路
新手上路
 
帖子: 8
注册: 2009-04-22 3:24
地址: 网粽之家

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子ldcr138 » 2009-12-26 14:58

不错,学习先
ldcr138
中级会员
中级会员
 
帖子: 56
注册: 2009-09-07 15:06

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子wto-ugg » 2010-02-03 9:24

等会实践下
wto-ugg
普通会员
普通会员
 
帖子: 26
注册: 2010-02-02 14:16
QQ 帐号: 1023702605

Re: iis下zencart静态SEO实现方法汇总,FOR1.2.7&1.3.01

帖子wto-ugg » 2010-02-04 14:54

iis实现静态化还有别的方法吗?
wto-ugg
普通会员
普通会员
 
帖子: 26
注册: 2010-02-02 14:16
QQ 帐号: 1023702605

下一页

  • 相关话题
    回复总数
    阅读次数
    最新文章

回到 精华共享



在线用户

正在浏览此版面的用户:没有注册用户 和 0 位游客