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: Map File to already friendly URLs
Author
Message |
ChipWV
Newbie


Joined: 13 October 2011
Location: United States
Posts: 6
Posted: 13 October 2011 at 3:15pm

I did a good bit of searching and couldn't find an exact
solution, but it looks like ISAPI will accomplish my
task. Here's the problem:

Old URL:
http://www.ovisonline.com/store/detail.asp?
product_id=RAS-ML-HDCR

New URL:
http://www.ovisonline.com/Chrome-Heavy-Duty-Mixer-Lift-
or-Appliance-Lift-P12.aspx

As you can see, the new URLs are already being rewritten
by our ecommerce software. I was hoping a map file may
work with something like this:

Chrome-Heavy-Duty-Mixer-Lift-or-Appliance-Lift-P12.aspx   
RAS-ML-HDCR

I've had no problem using IIS7 to do a 301 redirects for
static URL's but I can only get it to pass
"product_id=RAS-ML-HDCR" to the new page with dynamic
URLs.

I don't currently own or have a command of the usage of
ISAPI so an exact solution to the above would solve my
problem quickly, and allow an easier learning curve.

Thanks!
Back to Top Visit ChipWV's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 17 October 2011 at 4:23am

So do you want your 301-redirects to be done by IIS Rewriter and your rewrites by ISAPI_Rewrite, correct? (we'd suggest doing both with one tool only)
You'll need smth like this to rewrite the new URLs:

Code:
RewriteEngine on
RewriteBase /

RewriteMap revmapfile txt:revmapfile.txt

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^./]+)\.aspx$ /store/detail.asp?product_id=${revmapfile:$1} [NC,L]


Regards
Andrew
Back to Top
 
ChipWV
Newbie


Joined: 13 October 2011
Location: United States
Posts: 6
Posted: 17 October 2011 at 9:00am

I'd love to do the 301 redirects with one tool or the other, however, I feel
I'll need to let my ecommerce software continue to create the friendly
urls. this is from a management perspective, and those a already
indexed, and I'd run the risk of having an error in a URL and creating
duplicate content.

What I'd like to do is have ISAPI do all the 301 redirects. I just have
most of the static urls already redirected with IIS7, but i could remove
those if it created a performance hit by doing both.
Back to Top Visit ChipWV's Homepage
 
ChipWV
Newbie


Joined: 13 October 2011
Location: United States
Posts: 6
Posted: 23 October 2011 at 2:20pm

Hi Andrew,

Thanks for your help and patience with this. I can't seem to get this working. Site looped all URLs back to home page. I've been reading more help files and posts, so maybe I can explain better.

I want to use a map file to 301 redirect pages that no longer exist to the new site URLs.

He's an example of a line in my map file:

Chrome-Heavy-Duty-Mixer-Lift-or-Appliance-Lift-P12.aspx RAS-ML-HDCR

Should the .aspx be removed?
Where exactly should the map file be located in the directory structure?
I think I must be missing something fairly simple. I just can't get the syntax through my head. The more I read, the more I get confused.

Oh, also if an id does not exist in the map file, i'd like it to be redirected to the home page.

Back to Top Visit ChipWV's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 24 October 2011 at 7:20am

Hello,

a) If you used the rules that I've provided than you should have the following entry in your mapfile instead of existing:
Code:
Chrome-Heavy-Duty-Mixer-Lift-or-Appliance-Lift-P12 RAS-ML-HDCR


b) to solve the situation with the
RewriteEngine on
RewriteBase /

RewriteMap revmapfile txt:revmapfile.txt

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${mapfile:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^([^./]+)\.aspx$ /store/detail.asp?product_id=${revmapfile:$1} [NC,L]


Regards
Andrew
Back to Top
 
ChipWV
Newbie


Joined: 13 October 2011
Location: United States
Posts: 6
Posted: 24 October 2011 at 11:59am

Still no joy.

Using this:

RewriteEngine on
RewriteBase /

RewriteMap revmapfile txt:revmapfile.txt

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond ${mapfile:$1|NOT_FOUND} !NOT_FOUND
RewriteRule ^([^./]+)\.aspx$ /store/detail.asp?product_id=${revmapfile:$1} [NC,L]

And this: Chrome-Heavy-Duty-Mixer-Lift-or-Appliance-Lift-P12 RAS-ML-HDCR

Tried with both a space and a tab between the URL and Product_ID

I used the test utility and all I get is "pattern not matched"

I turned on logging, here's a sample

 Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:30 GMT [www.ovisonline.com/sid#2][rid#109594592/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'Default.aspx'
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:30 GMT [www.ovisonline.com/sid#2][rid#109594592/initial] (4) RewriteCond: input='\\?\D:\inetpub\wwwroot\ac7_ovisonline\Default.aspx' pattern='!-f' => not-matched
64.181.15.249 64.181.15.249  Mon, 24-Oct-2011  11:44:31 GMT [www.ovisonline.com/sid#2][rid#109596224/initial] (2) init rewrite engine with requested uri /store/detail.asp?product_id=RAS-ML-HDCR
64.181.15.249 64.181.15.249  Mon, 24-Oct-2011  11:44:31 GMT [www.ovisonline.com/sid#2][rid#109596224/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
64.181.15.249 64.181.15.249  Mon, 24-Oct-2011  11:44:31 GMT [www.ovisonline.com/sid#2][rid#109596224/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'store/detail.asp'
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:32 GMT [www.ovisonline.com/sid#2][rid#110057704/initial] (2) init rewrite engine with requested uri /Default.aspx
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:32 GMT [www.ovisonline.com/sid#2][rid#110057704/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:32 GMT [www.ovisonline.com/sid#2][rid#110057704/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'Default.aspx'
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:32 GMT [www.ovisonline.com/sid#2][rid#110057704/initial] (4) RewriteCond: input='\\?\D:\inetpub\wwwroot\ac7_ovisonline\Default.aspx' pattern='!-f' => not-matched
64.181.15.249 64.181.15.249  Mon, 24-Oct-2011  11:44:32 GMT [www.ovisonline.com/sid#2][rid#109594592/initial] (2) init rewrite engine with requested uri /store/detail.asp?product_id=RAS-ML-HDCR
64.181.15.249 64.181.15.249  Mon, 24-Oct-2011  11:44:32 GMT [www.ovisonline.com/sid#2][rid#109594592/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
64.181.15.249 64.181.15.249  Mon, 24-Oct-2011  11:44:32 GMT [www.ovisonline.com/sid#2][rid#109594592/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'store/detail.asp'
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:33 GMT [www.ovisonline.com/sid#2][rid#110060968/initial] (2) init rewrite engine with requested uri /Default.aspx
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:33 GMT [www.ovisonline.com/sid#2][rid#110060968/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
161.69.30.152 161.69.30.152  Mon, 24-Oct-2011  11:44:33 GMT [www.ovisonline.com/sid#2][rid#110060968/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'Default.aspx'

Thanks!
Chip

PS: The error.log shows:
10/24/2011 10:00:09] ISAPI Filter loaded. Version 3.1.0.87. Windows 6.0 (Build 6002 ServicePack:2) ProductType SERVER. CPU type INTEL  NumberOfProcessors 4.
[10/24/2011 10:33:59] ISAPI Filter loaded. Version 3.1.0.87. Windows 6.0 (Build 6002 ServicePack:2) ProductType SERVER. CPU type INTEL  NumberOfProcessors 4.
[10/24/2011 11:44:13] C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully
[10/24/2011 11:54:09] Map file c:\program files\helicon\isapi_rewrite3\revmapfile.txt - Loaded successfully
[10/24/2011 11:54:09] C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully
[10/24/2011 11:54:18] Map file c:\program files\helicon\isapi_rewrite3\revmapfile.txt - Loaded successfully
[10/24/2011 11:54:18] C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully
[10/24/2011 11:55:55] Map file c:\program files\helicon\isapi_rewrite3\revmapfile.txt - Loaded successfully
[10/24/2011 11:55:55] C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully
[10/24/2011 12:07:43] Map file c:\program files\helicon\isapi_rewrite3\revmapfile.txt - Loaded successfully
[10/24/2011 12:07:43] C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf - Loaded successfully

Here's some more from the rewrite log file. It seems to be matching of the ASPX files but not the ASP files. That seems backwards to me.

67.195.115.159 67.195.115.159  Mon, 24-Oct-2011  12:22:59 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (2) init rewrite engine with requested uri /Search.aspx?m=4&p=3
67.195.115.159 67.195.115.159  Mon, 24-Oct-2011  12:22:59 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
67.195.115.159 67.195.115.159  Mon, 24-Oct-2011  12:22:59 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'Search.aspx'
67.195.115.159 67.195.115.159  Mon, 24-Oct-2011  12:22:59 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (4) RewriteCond: input='\\?\D:\inetpub\wwwroot\ac7_ovisonline\Search.aspx' pattern='!-f' => not-matched
157.55.116.36 157.55.116.36  Mon, 24-Oct-2011  12:23:00 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (2) init rewrite engine with requested uri /store/detail.asp?product_id=8085-126-P
157.55.116.36 157.55.116.36  Mon, 24-Oct-2011  12:23:00 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
157.55.116.36 157.55.116.36  Mon, 24-Oct-2011  12:23:00 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'store/detail.asp'
157.55.116.36 157.55.116.36  Mon, 24-Oct-2011  12:23:04 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (2) init rewrite engine with requested uri /Store/search_results.asp?PAGE=18&txtsearchParamType=ALL&txtsearchParamCat=8&txtsearchParamMan=ALL&txtsearchParamVen=ALL&txtFromSearch=fromSearch&iLevel=1
157.55.116.36 157.55.116.36  Mon, 24-Oct-2011  12:23:04 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
157.55.116.36 157.55.116.36  Mon, 24-Oct-2011  12:23:04 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'Store/search_results.asp'
67.195.115.159 67.195.115.159  Mon, 24-Oct-2011  12:23:06 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (2) init rewrite engine with requested uri /store/detail.asp?product_id=SHR-84
67.195.115.159 67.195.115.159  Mon, 24-Oct-2011  12:23:06 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
67.195.115.159 67.195.115.159  Mon, 24-Oct-2011  12:23:06 GMT [www.ovisonline.com/sid#2][rid#109593368/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'store/detail.asp'
66.249.71.72 66.249.71.72  Mon, 24-Oct-2011  12:23:41 GMT [www.ovisonline.com/sid#2][rid#110060152/initial] (2) init rewrite engine with requested uri /Product.aspx?ProductId=369
66.249.71.72 66.249.71.72  Mon, 24-Oct-2011  12:23:41 GMT [www.ovisonline.com/sid#2][rid#110060152/initial] (1) Htaccess process request C:\Program Files\Helicon\ISAPI_Rewrite3\httpd.conf
66.249.71.72 66.249.71.72  Mon, 24-Oct-2011  12:23:41 GMT [www.ovisonline.com/sid#2][rid#110060152/initial] (3) applying pattern '^([^./]+)\.aspx$' to uri 'Product.aspx'
66.249.71.72 66.249.71.72  Mon, 24-Oct-2011  12:23:41 GMT [www.ovisonline.com/sid#2][rid#110060152/initial] (4) RewriteCond: input='\\?\D:\inetpub\wwwroot\ac7_ovisonline\Cabinet-Knob-Appalachia-White-Pine-P369.aspx' pattern='!-f' => matched
66.249.71.72 66.249.71.72  Mon, 24-Oct-2011  12:23:41 GMT [www.ovisonline.com/sid#2][rid#110060152/initial] (4) RewriteCond: input='\\?\D:\inetpub\wwwroot\ac7_ovisonline\Cabinet-Knob-Appalachia-White-Pine-P369.aspx' pattern='!-d' => matched
66.249.71.72 66.249.71.72  Mon, 24-Oct-2011  12:23:41 GMT [www.ovisonline.com/sid#2][rid#110060152/initial] (5) map lookup FAILED: map=mapfile[txt] key=Product
66.249.71.72 66.249.71.72  Mon, 24-Oct-2011  12:23:41 GMT [www.ovisonline.com/sid#2][rid#110060152/initial] (4) RewriteCond: input='NOT_FOUND' pattern='NOT_FOUND' => not-matched

 

Thanks!

Chip



Edited by ChipWV - 24 October 2011 at 12:35pm
Back to Top Visit ChipWV's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 25 October 2011 at 8:02am

According to the log the following requests have been made:

Code:
/store/detail.asp?product_id=RAS-ML-HDCR
/Default.aspx
/Search.aspx?m=4&p=3
/store/detail.asp?product_id=8085-126-P
/Product.aspx?ProductId=369



While we were expecting:
Quote:
Chrome-Heavy-Duty-Mixer-Lift-or-Appliance-Lift-P12.aspx


p.s. did we do all this wrong? And you wanted it to be requested as /store/detail.asp?product_id=RAS-ML-HDCR and then redirected to Chrome-Heavy-Duty-Mixer-Lift-or-Appliance-Lift-P12.aspx ?

Regards
Andrew
Back to Top
 
ChipWV
Newbie


Joined: 13 October 2011
Location: United States
Posts: 6
Posted: 25 October 2011 at 8:17am

Quote:
p.s. did we do all this wrong? And you wanted it to be requested as /store/detail.asp?product_id=RAS-ML-HDCR and then redirected to Chrome-Heavy-Duty-Mixer-Lift-or-Appliance-Lift-P12.aspx ?

Yes this is what we need to do. From my first post

Quote:
Old URL:
http://www.ovisonline.com/store/detail.asp?
product_id=RAS-ML-HDCR

New URL:
http://www.ovisonline.com/Chrome-Heavy-Duty-Mixer-Lift-
or-Appliance-Lift-P12.aspx

So when someone requests RAS-ML-HDCR they need to be 301 redirected to Chrome-Heavy-Duty-Mixer-Lift-
or-Appliance-Lift-P12.aspx

Thanks
Chip

Back to Top Visit ChipWV's Homepage
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 25 October 2011 at 8:50am

To achieve this redirect please, use the following code in addition to the existing:

Code:
RewriteEngine on
RewriteBase /

RewriteMap mapfile txt:mapfile.txt
RewriteCond %{QUERY_STRING} ^product_id=(.+)$
RewriteCond ${mapfile:%1|NOT_FOUND} !NOT_FOUND
RewriteRule ^store/detail\.asp$ /${mapfile:%1}.aspx [NC,R=301,L]


and mapfile.txt should look like:
Code:
RAS-ML-HDCR Chrome-Heavy-Duty-Mixer-Lift-or-Appliance-Lift-P12


Regards
Andrew
Back to Top
 
ChipWV
Newbie


Joined: 13 October 2011
Location: United States
Posts: 6
Posted: 25 October 2011 at 9:24am

Works perfectly now!

Thanks for your help! I have one or two more old URLs to redirect, but they are not as important, and I think I can figure it out on my own from this point forward.

Thanks!
Chip

Back to Top Visit ChipWV's Homepage
 

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

Printable version Printable version