This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: New User Trying to get started
Author
Message |
Rg1981
Newbie


Joined: 28 December 2011
Location: Australia
Posts: 8
Posted: 28 December 2011 at 11:47pm

Hi,

We have a site that is on an iis 6 shared server. The hosting company has installed the ISAPI_Rewrite 3 which we have purchased.

I have gone through the documentation but was not able to get it to work.

What I'm try to rewrite is -
http://www.racenet.com.au/races/Group-1.asp?Racename=All Aged Stakes
to
http://www.racenet.com.au/races/All Aged Stakes

I assumed if I created a .htaccess in the races folder with the following it would work.

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ Group-1.asp?Racename=$1 [L,QSA]

Can some please help.
Back to Top Visit Rg1981's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 29 December 2011 at 4:28am

Please try to put the following .htaccess in the ROOT of your site:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^races/(.*)$ races/Group-1.asp?Racename=$1 [L,QSA]

__________________
Regards,
Anton
Back to Top
 
Rg1981
Newbie


Joined: 28 December 2011
Location: Australia
Posts: 8
Posted: 29 December 2011 at 5:29pm

Thanks for the reply.

Should the redirect work instantly?

I have have placed the .htaccess file in the root directory and still there is no redirect.

Also What do I need to place in the code to replace the spaces in the variable to - (dash)?
Back to Top Visit Rg1981's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 03 January 2012 at 5:08am

"What do I need to place in the code to replace the spaces in the variable to - (dash)"
- here are the lines:

RewriteCond %{QUERY_STRING} ^(.*)(?:\%20|\s)(.*)$
RewriteRule (.*) $1\?%1-%2 [NC,LP]

As for the config, please enable logging in httpd.conf be putting

RewriteLogLevel 9

and provide rewrite.log records related to the non-working request.

__________________
Regards,
Anton
Back to Top
 
Rg1981
Newbie


Joined: 28 December 2011
Location: Australia
Posts: 8
Posted: 03 January 2012 at 8:06pm

Hi Anton,

From the start what I have done is purchased the ISAPI_Rewrite 3.0 in which I had to upload the server and the company installed it for me.

After the install the following files were added to the folder.

error.log
httpd.conf
ISAPI_Rewrite.dll

I just assumed that if I used .htaccess file it would just work after the install.

I was informed by my hosting company that....

"As your site is hosted on a IIS based server, the .htaccess file is invalid."

So what are my other options to get this running.

They provided me with this link.
http://www.helicontech.com/cms_articles/provocative_SEF_URLs.doc

But this doesn't help as I don't have access to
Program Files/Helicon/ISAPI_Rewrite/httpd.ini
and I'm not using asp.net.

I'm lost as to what I'm meant to do, I thought it would be simple.
Back to Top Visit Rg1981's Homepage
 
Rg1981
Newbie


Joined: 28 December 2011
Location: Australia
Posts: 8
Posted: 03 January 2012 at 8:43pm

Just an update apparently I have to use a web.config file.
Back to Top Visit Rg1981's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 04 January 2012 at 7:50am

Hello,

"After the install the following files were added to the folder."
- what folder were those files added to? Was it the site root?
- I guess you are on a shared hosting, right? Then you need .htaccess file (not httpd.conf) in the root of your site to have ISAPI_Rewrite 3
working for you.
"As your site is hosted on a IIS based server, the .htaccess file is invalid."
- this is wrong... It's absolutely valid.

- Could you test if any ISAPI_Rewrite rules work for you at all? Try it with the simple rule like this:

RewriteRule testtest http\://www.google.com

Then make request to www.yoursite.com/testtest and report what you get. It should be the Google page.

__________________
Regards,
Anton
Back to Top
 
Rg1981
Newbie


Joined: 28 December 2011
Location: Australia
Posts: 8
Posted: 04 January 2012 at 10:17pm

Hi,

Yes the site is on a shared server.
I have been in contact with the hosting company too and here is the feed back they have given me?


Please note that we have only been able to install ISAPI rewrite 2 on the server.

You can find documenation on the Helicon website

http://www.isapirewrite.com/docs/#config

Specifically 

Configuration file format

There are two types of configuration files - global (server-level) and individual (site-level) 
files. The global configuration file should be named httpd.ini and should appear in the 
ISAPI_Rewrite installation directory. The shortcut of this file is provided through the start menu. 
The individual configuration files should be named httpd.ini and could appear in physical root 
directories of virtual sites. All configuration files have the same format. And it is the format of 
a standard Windows INI file where settings are broken by sections. The only section allowed in this 
version of ISAPI_Rewrite is [ISAPI_Rewrite]. All directives should be placed in this section and 
each directive should be placed on a separate line. Any text outside this section will be ignored.

httpd.ini file example:

[ISAPI_Rewrite]

# This is a comment

# 300 = 5 minutes
CacheClockRate 300
RepeatLimit 20

# Block external access to the httpd.ini and httpd.parse.errors files
RewriteRule /httpd(?:\.ini|\.parse\.errors) / [F,I,O]

# Block external access to the Helper ISAPI Extension
RewriteRule .*\.isrwhlp / [F,I,O]

# Some custom rules
RewriteCond Host: (.+)
RewriteRule (.*) /$1$2 

Back to Top Visit Rg1981's Homepage
 
Rg1981
Newbie


Joined: 28 December 2011
Location: Australia
Posts: 8
Posted: 05 January 2012 at 12:17am

Hi

So it looks like they installed ISAPI_Rewrite 2 instead of 3.
I'd say that's fine because that will still serve by purpose.


I have added the following rule httpd.ini file and http://www.racenet.com.au/races/All Aged Stakes now works.

RewriteRule /races/(.*)$ /races/Group-1.asp?Racename=$1 [I,L]

What do I need to place in the code to replace the spaces in the variable to - (dash)
so instead of
http://www.racenet.com.au/races/Group-1.asp?Racename=All Aged Stakes
it should be
http://www.racenet.com.au/races/Group-1.asp?Racename=All-Aged-Stakes
Back to Top Visit Rg1981's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 05 January 2012 at 2:48am

Please try to have the following:

RewriteRule /races/(.*)(?:\%20|\s)(.*)$ /races/Group-1.asp\?Racename=$1-$2 [I,NS,L]


Edited by Anton - 05 January 2012 at 2:48am


__________________
Regards,
Anton
Back to Top
 
Rg1981
Newbie


Joined: 28 December 2011
Location: Australia
Posts: 8
Posted: 05 January 2012 at 7:03pm

Thanks you again for your reply Anton.

Ok I didn't explain what I was trying to do with the dash correctly.

What I need to work is

http://www.racenet.com.au/races/All-Aged-Stakes
When I try that url i get a page not found error.

But when I go to
http://www.racenet.com.au/races/All Aged Stakes
it works.
I need the url with the dashes replacing spaces to work.

Also is there a method so that if someone goes to

http://www.racenet.com.au/races/Group-1.asp?Racename=All Aged Stakes

It would redirect to

http://www.racenet.com.au/races/All-Aged-Stakes

Thanks in advance for your help.


Edited by Rg1981 - 05 January 2012 at 7:04pm
Back to Top Visit Rg1981's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 06 January 2012 at 4:04am

Ok, let's try the following rules for what you want:

RewriteRule /races/Group-1.asp\?Racename=(.*)(?:\%20|\s)(.*) /races/Group-1.asp\?Racename=$1-$2 [I,NS]
RewriteRule /races/Group-1.asp\?Racename=(.+) /races/$1 [I,RP]

RewriteRule /races/(.*)-(.*)$ /races/$1\s$2 [I,NS]
RewriteRule /races/([^-]+)$ /races/Group-1.asp\?Racename=$1 [I,L]

__________________
Regards,
Anton
Back to Top
 
Rg1981
Newbie


Joined: 28 December 2011
Location: Australia
Posts: 8
Posted: 06 January 2012 at 5:14pm

Thanks Anton.

There's one issue now.

The variable is now being passed as AllsAgedsStakes when the page is loaded. It needs to be either All Aged Stakes or All-Aged-Stakes for the script within the page to work.
Everything else is working perfectly.

Thanks


Edited by Rg1981 - 09 January 2012 at 5:46pm
Back to Top Visit Rg1981's Homepage
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 10 January 2012 at 2:57am

Please try the following config with some fixes:

RewriteRule /races/Group-1.asp\?Racename=(\S+)(?:\%20|\s)(.+) /races/Group-1.asp\?Racename=$1-$2 [I,NS]
RewriteRule /races/Group-1.asp\?Racename=(.+) /races/$1 [I,RP]

RewriteRule /races/([^-]+)-(.+)$ /races/$1\s$2 [I,NS]
RewriteRule /races/([^-]+)$ /races/Group-1.asp\?Racename=$1 [I,L]

__________________
Regards,
Anton
Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version