This forum has been moved here:
Helicon Tech Community Forum

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  HelpHelp   RegisterRegister  LoginLogin
ISAPI_Rewrite 2.x
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: help with a quick rewrite Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
whizzinisapi
Groupie
Groupie


Joined: 21 May 2004
Location: United States
Online Status: Offline
Posts: 50
Posted: 05 April 2011 at 4:14pm | IP Logged Quote whizzinisapi

Our structure should always be like this.
http://www.widgets.com/a/b/redwidget.htm

For some reason in Google webmaster tools we see 404 errors because the url somehow loses the 2nd directory. It shows like this.
http://www.widgets.com/a/redwidget.htm

We would like isapi to automatically fix this for us.

So...
http://www.widgets.com/a/redwidget.htm should redirect to
http://www.widgets.com/a/b/redwidget.htm

Can someone help with this please.
Back to Top View whizzinisapi's Profile Search for other posts by whizzinisapi
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 06 April 2011 at 5:38am | IP Logged Quote Anton

It's as simple as:

[ISAPI_Rewrite]

RewriteRule /a/([^./]+)\.htm http\://www.widgets.com/a/b/$1.htm [I,RP]

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


Joined: 21 May 2004
Location: United States
Online Status: Offline
Posts: 50
Posted: 06 April 2011 at 3:35pm | IP Logged Quote whizzinisapi

I accidentally mixed this up.
The URL loses the 1st directory. It shows like this.
http://www.widgets.com/b/redwidget.htm

So...
http://www.widgets.com/b/redwidget.htm should redirect to
http://www.widgets.com/a/b/redwidget.htm

Can you please fix this?
Back to Top View whizzinisapi's Profile Search for other posts by whizzinisapi
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 07 April 2011 at 1:45am | IP Logged Quote Anton

Like this then:

RewriteRule /b/([^./]+)\.htm http\://www.widgets.com/a/b/$1.htm [I,RP]

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


Joined: 21 May 2004
Location: United States
Online Status: Offline
Posts: 50
Posted: 24 June 2011 at 6:19pm | IP Logged Quote whizzinisapi

This seems to not work when there is a querystring behind the .htm. What can we do to make it work when there is a querystring? The querystring is dynamic obviously.

Code:
http://www.widgets.com/b/redwidget.htm?pageStyle=h&ProdSort=19&page=2&idCategory=87


should redirect to

Code:

http://www.widgets.com/a/b/redwidget.htm?pageStyle=h&ProdSort=19&page=2&idCategory=87
Back to Top View whizzinisapi's Profile Search for other posts by whizzinisapi
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 25 June 2011 at 2:48am | IP Logged Quote Anton

Sure we can do it:

RewriteRule /b/([^./]+)\.htm(?:\?(.+))? http\://www.widgets.com/a/b/$1.htm(?2\?$2) [I,RP]

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

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 cannot vote in polls in this forum