Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 3.0 support forum
 Helicon Tech : ISAPI_Rewrite 3.0 support forum
Subject Topic: adding extra / or \ to url Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
thewebnsoft
Newbie
Newbie


Joined: 07 April 2007
Location: India
Online Status: Offline
Posts: 15
Posted: 18 June 2008 at 6:18am | IP Logged Quote thewebnsoft

hi all,

have just migrated one site form Apache server to IIS with ISAPI3, thouugh all of my rewrite rules are working fine, but i am having a strange issue, if i open the site in IE, the Rewrite rules are adding one extra slash (/) just after http_host, and if i open site in mozilla they are adding one backslash (\) so site is not working in mozilla..

another thing, my default page is index.php, but in code i have linkd Home anchor to index.html, it was working fine with my previous server but not on this one..?? will be very thankful if someone can help me out.



__________________
RESELLER WEB HOSTING INDIA
Back to Top View thewebnsoft's Profile Search for other posts by thewebnsoft Visit thewebnsoft's Homepage
 
Sergey
Moderator Group
Moderator Group


Joined: 11 March 2005
Online Status: Offline
Posts: 742
Posted: 19 June 2008 at 6:09am | IP Logged Quote Sergey

Please show rewrite rules and rewrite.log records corresponding for backslash issue.

Please try add to "Default Documents" index.php and index.html in IIS settings->Document tab.
Back to Top View Sergey's Profile Search for other posts by Sergey
 
thewebnsoft
Newbie
Newbie


Joined: 07 April 2007
Location: India
Online Status: Offline
Posts: 15
Posted: 23 June 2008 at 8:04am | IP Logged Quote thewebnsoft

Sorry for delayed posting, i am using the following in .htaccess:

*****************************************

RewriteEngine on
RewriteBase /

#ErrorDocument 404 /index.php

#cre SEO check for images and skip all the other rules for performance reasons only
RewriteRule ^.*\.gif|\.jpg|\.png|\.css|\.php$ - [L]

# cre SEO reformats for product_info.html pages
RewriteRule ^m([0-9]+_?[0-9]*)/?(.*)/p([0-9]+_?[0-9]*)/(.*)/product_info\.html$ product_info.php?manufacturers_id=$1&products_id=$3 [QSA,L]
RewriteRule ^p([0-9]+_?[0-9]*)/(.*)/product_info\.html$ product_info.php?products_id=$1 [QSA,L]
RewriteRule ^(.*)/c([^/]*)/p([0-9]+_?[0-9]*)/(.*)/product_info\.html$ product_info.php?cPath=$2&products_id=$3 [QSA,L]

# cre SEO reformat for index.html pages
RewriteRule ^m([0-9]+_?[0-9]*)/?(.*)/p([0-9]+_?[0-9]*)/(.*)/index\.html$ index.php?manufacturers_id=$1&products_id=$3 [QSA,L]
RewriteRule ^m([0-9]+_?[0-9]*)/(.*)/index\.html$ index.php?manufacturers_id=$1 [QSA,L]
RewriteRule ^(.*)/c([^/]*)/p([0-9]+_?[0-9]*)/(.*)/index\.html$ index.php?cPath=$2&products_id=$3 [QSA,L]
RewriteRule ^(.*)/c([^/]*)/index\.html$ index.php?cPath=$2 [QSA,L]

# cre SEO reformat for information.html pages
RewriteRule ^i([0-9]+_?[0-9]*)/(.*)/information\.html$ information.php?info_id=$1 [QSA,L]

# cre SEO reformat for pages.html pages
RewriteRule ^p([0-9]+_?[0-9]*)/(.*)/pages\.html$ pages.php?pID=$1 [QSA,L]
RewriteRule ^(.*)/c([^/]*)/p([0-9]+_?[0-9]*)/(.*)/pages\.html$ pages.php?cID=$2&pID=$3 [QSA,L]
RewriteRule ^(.*)/c([^/]*)/pages\.html$ pages.php?cID=$2 [QSA,L]

# cre SEO reformat for articles.html pages
RewriteRule ^(.*)/t([^/]*)/a([0-9]+_?[0-9]*)/(.*)/articles\.html$ articles.php?tPath=$2&articles_id=$3 [QSA,L]
RewriteRule ^(.*)/t([^/]*)/articles\.html$ articles.php?tPath=$2 [QSA,L]

# cre SEO reformat for article_info.html pages
RewriteRule ^a([0-9]+_?[0-9]*)/(.*)/article_info\.html$ article_info.php?articles_id=$1 [QSA,L]
RewriteRule ^(.*)/t([^/]*)/article_info\.html$ article_info.php?tPath=$2 [QSA,L]

# cre SEO reformats for product_reviews.html pages
RewriteRule ^p([0-9]+_?[0-9]*)/(.*)/product_reviews\.html$ product_reviews.php?products_id=$1 [QSA,L]
RewriteRule ^(.*)/c([^/]*)/p([0-9]+_?[0-9]*)/(.*)/product_reviews\.html$ product_reviews.php?products_id=$3 [QSA,L]

# cre SEO reformats for product_reviews_info.html pages
RewriteRule ^p([0-9]+_?[0-9]*)/(.*)/review([0-9]+_?[0-9]*)/product_reviews_info\.html$ product_reviews_info.php?products_id=$1&reviews_id=$3 [QSA,L]

#cre SEO catch all in case other rules did not match
RewriteRule ^(product_info|index|information|pages|articles|article_info|product_reviews|product_reviews_info)\.html$ $1.php [QSA,L]

#for Wholesale URL
RewriteRule ^wholesale are_u_reseller.php [QSA,L]
RewriteRule ^Wholesale are_u_reseller.php [QSA,L]
RewriteRule ^WholeSale are_u_reseller.php [QSA,L]
RewriteRule ^WHOLESALE are_u_reseller.php [QSA,L]

*************************************************

Site url is: http://198.65.116.204/

Thx a lot in advance



__________________
RESELLER WEB HOSTING INDIA
Back to Top View thewebnsoft's Profile Search for other posts by thewebnsoft Visit thewebnsoft's Homepage
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 9110
Posted: 24 June 2008 at 7:43am | IP Logged Quote Anton

The links on your page look like <a class="categoryText" href="http://198.65.116.204\/Bracelets/c8/index.html">Bracelets</a>
And they should be like <a class="categoryText" href="http://198.65.116.204/Bracelets/c8/index.html">Bracelets</a>

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
thewebnsoft
Newbie
Newbie


Joined: 07 April 2007
Location: India
Online Status: Offline
Posts: 15
Posted: 24 June 2008 at 8:17am | IP Logged Quote thewebnsoft

actually there is no backslash in code, and these urls are generated through .htaccess file, actually url is index.php?cPath=8 for the link you have told here. so exactly its being added by .htaccess as the same code is working fine on apache at http://www.jewelzdirect.com

Thx



__________________
RESELLER WEB HOSTING INDIA
Back to Top View thewebnsoft's Profile Search for other posts by thewebnsoft Visit thewebnsoft's Homepage
 
thewebnsoft
Newbie
Newbie


Joined: 07 April 2007
Location: India
Online Status: Offline
Posts: 15
Posted: 24 June 2008 at 8:18am | IP Logged Quote thewebnsoft

sorry for confusion, the line:

and these urls are generated through .htaccess file

shd be written as these urls are handeled by .htaccess, i know it may be a problem with my url generating code, but i have checked that properly.



__________________
RESELLER WEB HOSTING INDIA
Back to Top View thewebnsoft's Profile Search for other posts by thewebnsoft Visit thewebnsoft's Homepage
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 9110
Posted: 24 June 2008 at 8:29am | IP Logged Quote Anton

Can you please show you url generating code, we will check it as well.

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
thewebnsoft
Newbie
Newbie


Joined: 07 April 2007
Location: India
Online Status: Offline
Posts: 15
Posted: 24 June 2008 at 9:47am | IP Logged Quote thewebnsoft

Anton wrote:
Can you please show you url generating code, we will check it as well.

Code:

<?php
/*
SEO for CRE Loaded 6.1a
Version: 3.0
Author: MRB  (mrb@chainreactionweb.com)
Release date: 11/30/2004
Legal notices: Standard GNU License

Installation instructions: see readme.txt
Warning - do not use this on heavy loaded shops (more than 10000 visitors per day)
if you are not on dedicated server.

*/

function callback($pagecontent) {
  // find all the href thatr are part of the <a> tag
  $pagecontent = preg_replace_callback("/(<a\s+[^>]*href=['\"]{1})([^'\">]+)([^>]*>)/", 'transform_uri', $pagecontent);
 
  return $pagecontent;
}


function transform_uri($param) {
  global $languages_id, $seourlreads;
  // the url in the hrref should be passed here for reformatting
  // get the complete match and break it into pieces
  // need to allow for a partical href that uses relative addressing
  $uriparts = parse_url($param[2]);
  $scheme = isset( $uriparts['scheme'] ) ? $uriparts['scheme'] : '';
 
  // no reformat on SSL addresses
  if ( $scheme == 'https' ) return $param[0];
  if ( $scheme != '' ) $scheme .= '://';
 
  $host = isset( $uriparts['host'] ) ? $uriparts['host'] : '';
  $path = isset( $uriparts['path'] ) ? $uriparts['path'] : '';
  $query = isset( $uriparts['query'] ) ? $uriparts['query'] : '';
  $fragment = isset( $uriparts['fragment'] ) ? '#' . $uriparts['fragment'] : '';
 
  // get the page name and page path
  $path_parts = pathinfo( $path );
  $page_name = $path_parts['basename'];
  $page_path = $path_parts['dirname'];
 
  // allow for the pathinfo returning a '.' if there is no dirname
  if ( substr( $page_path, 0, 1 ) == '.' ) $page_path = '';
 
  // the page path may need a trailing /
 // if ( $page_path != '' && substr( $page_path, -1 ) != '/' ) $page_path .= '/';
 
 $page_path=str_replace("\","/",$page_path);
 
  // Find out what chacter to use if a space needs replacing
  if ( ! defined('CRE_SEO_SPACE_REPLACEMENT') ) {
    $space_replacement = '-';  // this is done for backward compatiablility, not really the best choice
  } else {
    $space_replacement = CRE_SEO_SPACE_REPLACEMENT;
  }
 
  // based on the page name, decide if reformating is required
  switch( $page_name ) {
    case 'index.php':
    case 'product_info.php':
    case 'articles.php':
    case 'article_info.php':
    case 'information.php':
    case 'pages.php':
    case 'product_reviews.php':
     
      // change the page name and reset the path to empty
      $page_name = substr( $page_name, 0, strlen($page_name) - 4 ) . '.html';
      $path = '';
     
      // process the query string
      if ( $query != '' ) {
        // repalce the &amp; with & for backward compatiablility
        $query = str_replace('&amp;', '&', $query);
        $query_parts = explode( '&', $query );
     
        //reset the query and path strings
        $query = '';
     
        // prcoess each piece found
        // Here is the odd part, normally a simple loop thru the parts found would do
        // however, because the rewrite rules require the parts to be processed in a certain order
        // The order of processing is set for backward comatiablility
     
        // find all the pieces to process
        $query_array = array();
        foreach ( $query_parts as $q ) {
          list( $key, $val ) = split( '=', $q );
          if ( ! empty( $key ) && ! empty( $val ) ) $query_array[$key] = $val;
        }
       
        if ( array_key_exists( 'cPath', $query_array ) ) {
          $val = $query_array['cPath'];
          // check to see if we already have this one
          if ( ! isset( $seourlreads['cPath'][$val] ) ) {
            $cat_arr = explode( '_', $val );
            $count = false;
            foreach( $cat_arr as $value ){
              $sql_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $value . "'  and c.categories_id = cd.categories_id and cd.language_id ='" . (int)$languages_id . "'");
              $cat_name = tep_db_fetch_array( $sql_query );
              if( !$count ){
                $result .= encode_str($cat_name['categories_name']);
                $count = true;
              } else {
                $result .= '-' . encode_str($cat_name['categories_name']);
              }
            }
            $cat = str_replace(' ' , $space_replacement , $result);
            $seourlreads['cPath'][$val] = $cat;
          } else {
            $cat = $seourlreads['cPath'][$val];
          }
          $path .= $cat . '/c' . $val . '/';
          unset( $query_array['cPath'] );
        }
       
        if ( array_key_exists( 'manufacturers_id', $query_array ) ) {
          $val = $query_array['manufacturers_id'];
          if ( ! isset( $seourlreads['manufacturers_id'][$val] ) ) {
            $sql_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $val . "'");
            $man = tep_db_fetch_array($sql_query );
            $mname = str_replace( " ", $space_replacement , encode_str($man['manufacturers_name']) );
            $seourlreads['manufacturers_id'][$val] = $mname;
          } else {
            $mname = $seourlreads['manufacturers_id'][$val];
          }
          $path .= 'm' . $val . '/' . $mname . '/';
          unset( $query_array['manufacturers_id'] );
        }
       
        if ( array_key_exists( 'products_id', $query_array ) ) {
          $val = $query_array['products_id'];
          if ( ! isset( $seourlreads['products_id'][$val] ) ) {
            $sql_query = tep_db_query('select products_name from ' . TABLE_PRODUCTS_DESCRIPTION . ' where products_id = "' . (int)$val . '" and language_id ="' . (int)$languages_id . '"');
            $t = tep_db_fetch_array($sql_query );
            $pname = str_replace( ' ', $space_replacement , encode_str($t['products_name']) );
            $seourlreads['products_id'][$val] = $pname;
          } else {
            $pname = $seourlreads['products_id'][$val];
          }
          $path .= 'p' . (int)$val . '/' . $pname . '/';
          unset( $query_array['products_id'] );
        }
       
        if ( array_key_exists( 'info_id', $query_array ) ) {
          $val = $query_array['info_id'];
          if ( ! isset( $seourlreads['info_id'][$val] ) ) {
            $sql_query = tep_db_query('select info_title from ' . TABLE_INFORMATION . ' where information_id = "' . (int)$val . '" and languages_id="' . (int)$languages_id . '"');
            $t = tep_db_fetch_array($sql_query );
            $pname = str_replace( ' ', $space_replacement , encode_str($t['info_title']) );
            $pname = str_replace( ' ', $space_replacement , encode_str($t['products_name']) );
            $seourlreads['info_id'][$val] = $pname;
          } else {
            $pname = $seourlreads['info_id'][$val];
          }
          $path .= 'i' . (int)$val . '/' . $pname . '/';
          unset( $query_array['info_id'] );
        }
       
        if ( array_key_exists( 'cID', $query_array ) ) {
          $val = $query_array['cID'];
          if ( ! isset( $seourlreads['cID'][$val] ) ) {
            $cat_arr = explode( '_', $val );
            $count = false;
            foreach( $cat_arr as $value ){
              $sql_query = tep_db_query("select ic.categories_id, icd.categories_name from " . TABLE_PAGES_CATEGORIES . " ic, " . TABLE_PAGES_CATEGORIES_DESCRIPTION . " icd where ic.categories_id = '" . $value . "'  and ic.categories_id = icd.categories_id and icd.language_id='" . (int)$languages_id . "'");
              $cat_name = tep_db_fetch_array( $sql_query );
              if( !$count ){
                $result .= encode_str($cat_name['categories_name']);
               $count = true;
              } else {
                $result .= '-' . encode_str($cat_name['categories_name']);
              }
            }
            $cat = str_replace(' ' , $space_replacement , $result);
            $seourlreads['cID'][$val] = $cat;
          } else {
            $cat = $seourlreads['cID'][$val];
          }
          $path .= $cat . '/c' . $val . '/';
          unset( $query_array['cID'] );
        }
       
        if ( array_key_exists( 'pID', $query_array ) ) {
          $val = $query_array['pID'];
          if ( ! isset( $seourlreads['pID'][$val] ) ) {
            $sql_query = tep_db_query('select pages_title from ' . TABLE_PAGES_DESCRIPTION . ' where pages_id = "' . (int)$val . '" and language_id = "' . (int)$languages_id . '"');
            $t = tep_db_fetch_array($sql_query );
            $pname = str_replace( ' ', $space_replacement , encode_str($t['pages_title']) );
            $seourlreads['pID'][$val] = $pname;
          } else {
            $pname = $seourlreads['pID'][$val];
          }
          $path .= 'p' . (int)$val . '/' . $pname . '/';
          unset( $query_array['pID'] );
        }
     
        if ( array_key_exists( 'reviews_id', $query_array ) ) {
          $val = $query_array['reviews_id'];
          $path .= 'review' . $val . '/';
          unset( $query_array['reviews_id'] );
        }
     
        if ( array_key_exists( 'tPath', $query_array ) ) {
          $val = $query_array['tPath'];
          if ( ! isset( $seourlreads['tPath'][$val] ) ) {
            $cat_arr = explode( '_', $val );
            $count = false;
            foreach( $cat_arr as $value ){
              $sql_query = tep_db_query("select t.topics_id, td.topics_name from " . TABLE_TOPICS . " t, " . TABLE_TOPICS_DESCRIPTION . " td where t.topics_id = '" . $value . "'  and t.topics_id = td.topics_id and td.language_id='" . (int)$languages_id . "'");
              $cat_name = tep_db_fetch_array($sql_query );
              if( !$count ){
                $result .= encode_str($cat_name['topics_name']);
                $count = true;
             } else {
              $result .= '-' . encode_str($cat_name['topics_name']);
              }
            }
            $cat = str_replace(' ' , $space_replacement , $result);
            $seourlreads['tPath'][$val] = $cat;
          } else {
            $cat = $seourlreads['tPath'][$val];
          }
          $path .= $cat . '/t' . $val . '/';
          unset( $query_array['tPath'] );
        }
       
        if ( array_key_exists( 'articles_id', $query_array ) ) {
          $val = $query_array['articles_id'];
          if ( ! isset( $seourlreads['articles_id'][$val] ) ) {
            $sql_query = tep_db_query('select articles_name from ' . TABLE_ARTICLES_DESCRIPTION . ' where articles_id = "' . (int)$val . '" and language_id="' . (int)$languages_id . '"');
            $t = tep_db_fetch_array($sql_query );
            $pname = str_replace( ' ', $space_replacement , encode_str($t['articles_name']) );
            $seourlreads['articles_id'][$val] = $pname;
          } else {
            $pname = $seourlreads['articles_id'][$val];
          }
          $path .= 'a' . (int)$val . '/' . $pname . '/';
          unset( $query_array['articles_id'] );
        }
       
        // any remain query keys goes back into the query string
        foreach ( $query_array as $key => $val ) {
          $query .= '&amp;' . $key . '='.$val;
        }
       
        // remove leading &amp; if needed
        if ( $query != '' ) {
          if ( substr( $query, 0, 5) == '&amp;' ) $query = substr( $query, 5 );
          $query = '?' . $query;
        }
     
      }
      return $param[1] . $scheme . $host . $page_path . $path . $page_name . $query . $fragment . $param[3];
      break;
   
    default:
      return $param[0];
  }
     
}

function encode_str($str) {
  // replace all these special chanracter
  $str = str_replace( '"', '%22', $str );
  $str = str_replace( '#', '%23', $str );
  return $str;
}


// the seourlreads array provides a limited form of caching to prevent
// addittional queries from being done that have already been done
$seourlreads = array();

ob_start("callback");

 

?>



__________________
RESELLER WEB HOSTING INDIA
Back to Top View thewebnsoft's Profile Search for other posts by thewebnsoft Visit thewebnsoft's Homepage
 
thewebnsoft
Newbie
Newbie


Joined: 07 April 2007
Location: India
Online Status: Offline
Posts: 15
Posted: 28 June 2008 at 12:37am | IP Logged Quote thewebnsoft

is anyone there who can give support here.. because i tried to emil this issue to support@helicontech.com also and didn't recieve any email in 6 days.. its strange and seems like spending $99 for isapi is total waste if someone can't provide support from their side. even one another thing i found.. ISAPI dont support ErrorDcoument 404..???

its too strange how someone can have error document handling..?



__________________
RESELLER WEB HOSTING INDIA
Back to Top View thewebnsoft's Profile Search for other posts by thewebnsoft Visit thewebnsoft's Homepage
 
Anton
Moderator Group
Moderator Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 9110
Posted: 01 July 2008 at 3:21am | IP Logged Quote Anton

Sorry for delay with answer.
The code portion you've provided contains nothing connected with ISAPI_Rewrite.
Can you please provide a complete code of your php page so that we could reproduce the problem.


__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
thewebnsoft
Newbie
Newbie


Joined: 07 April 2007
Location: India
Online Status: Offline
Posts: 15
Posted: 01 July 2008 at 3:55am | IP Logged Quote thewebnsoft

Sir,

For your kind info if you have seen this code this is just getting the the randored html and replacing the <a href tag inside the code and this is the only code which is creating such urls.

 

and such urls are handled by .htaccess code of which has been already placed.

 



__________________
RESELLER WEB HOSTING INDIA
Back to Top View thewebnsoft's Profile Search for other posts by thewebnsoft Visit thewebnsoft's Homepage
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You can vote in polls in this forum