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 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: help with a quick rewrite
Author
Message |
whizzinisapi
Groupie


Joined: 21 May 2004
Location: United States
Posts: 50
Posted: 05 April 2011 at 4:14pm

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
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 06 April 2011 at 5:38am

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
 
whizzinisapi
Groupie


Joined: 21 May 2004
Location: United States
Posts: 50
Posted: 06 April 2011 at 3:35pm

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
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 07 April 2011 at 1:45am

Like this then:

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

__________________
Regards,
Anton
Back to Top
 
whizzinisapi
Groupie


Joined: 21 May 2004
Location: United States
Posts: 50
Posted: 24 June 2011 at 6:19pm

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
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 25 June 2011 at 2:48am

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
 

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

Printable version Printable version
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