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: Selective Rewrite (Topic Closed Topic Closed)
Author
Message |
deepak102ind
Newbie


Joined: 18 February 2006
Location: India
Posts: 22
Posted: 18 April 2006 at 4:14am  

Hi,

I have 2 different pages that may need URL rewriting but on different condition.

Page 1
I wish to convert
http://www.abc.com/ShowInfo.aspx?ckeyword=motor 

to
http://www.abc.com/motor.html

The expression I use is
RewriteRule (/[^-]+)-([^.]+\.html) $1%20$2 [N,I]
RewriteRule /([^.]+)\.html /ShowInfo.aspx\?ckeyword=$1 [I,L]

Page 2
------
I wish to convert
http://www.abc.com/GetInfo.aspx?ncatID=12
to
http://www.abc.com/GetInfo12.html

The expression I use is
RewriteRule (/[^-]+)-([^.]+\.html) $1%20$2 [N,I]
RewriteRule /([^.]+)\.html /getInfo.aspx\?nCatID=$1 [I,L]

The issue is, I want these rules to work selectively. Right now thye work for rule #1. Can you please suggest me what can I do for them to work based on page names instead?

Thanks,

Deepak Sharma
http://www.orientindia.biz



__________________
Senior Software Engineer,
Orient Technologies,
http://www.orientindia.biz
Back to Top Visit deepak102ind's Homepage
 
Lexey
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Posts: 8119
Posted: 18 April 2006 at 5:19pm  

The only way to do that is to specify exact page name in a pattern of at least one rule. Like:

RewriteRule /motor\.html /ShowInfo.aspx\?ckeyword=motor [I,L]
Back to Top
 
deepak102ind
Newbie


Joined: 18 February 2006
Location: India
Posts: 22
Posted: 18 April 2006 at 11:52pm  

Hi,

I tried the suggestion and that did not seems to be working. Cant we use some kind of rewrite condition instead of Rewriterule that works only when the URl contains a specific KW, else it jumps to second rule defination. Something like If Endif statements.

Here we have URls in question
http://www.abc.com/Excel74.html
AND
http://www.abc.com/DBHDI.html

which must be rewritten to
http://www.abc.com/?LCID=Excel74
AND
http://www.abc.com?ckeyword=DBHDI

What is required is that helicon must identify and apply rule based on the page name, that is  excel74 and DBHDI. Please note that these can change. Like the next time it can be excel05, excel06, excel07 or ABCDE, abcdf, abcdg or so.

Thanks,


Let me give you the details again



__________________
Senior Software Engineer,
Orient Technologies,
http://www.orientindia.biz
Back to Top Visit deepak102ind's Homepage
 
Lexey
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Posts: 8119
Posted: 19 April 2006 at 4:17pm  

deepak102ind wrote:
Hi, I tried the suggestion and that did not seems to be working.


It should work.

Quote:

Cant we use some kind of rewrite condition instead of Rewriterule that works only when the URl contains a specific KW, else it jumps to second rule defination.
Something like If Endif statements.


RewriteRule already has a condition. Additional conditions here will be simply useless.

Quote:

Here we have URls in questionhttp://www.abc.com/Excel74.htmlAND http://www.abc.com/DBHDI.htmlwhich must be rewritten to http://www.abc.com/?LCID=Excel74ANDhttp://www.abc.com?ckeyword=DBHDI


RewriteRule /Excel74\.html /?LCID=Excel74 [I,L]
RewriteRule /DBHDI\.html /?ckeyword=DBHDI [I,L]

Quote:

What is required is that helicon must identify and apply rule based on the page name, that is��excel74 and DBHDI. Please note that these can change. Like the next time it can be excel05, excel06, excel07�or ABCDE, abcdf, abcdg or so.


The only way to do this is to directly specify all possible values of a single type in a rule (or in many rules). Another single rule could handle all cases of another type.
However, I would recommend you to think about better solution. You are trying to mix two completely different entities in a same URI format. It would be better to explicitly split them. Like:

http://www.abc.com/LCID/Excel74.html

and

http://www.abc.com/kw/DBHDI.html.

In this case all possible values could be handled with two simple rules.
Back to Top
 
deepak102ind
Newbie


Joined: 18 February 2006
Location: India
Posts: 22
Posted: 19 April 2006 at 9:33pm  

========================
http://www.abc.com/LCID/Excel74.html
and
http://www.abc.com/kw/DBHDI.html.
In this case all possible values could be handled with two simple rules. =================================
Hi,

The above two are two seperate URI's. They represent two different pages (Excel.aspx and outpage.aspx). So finally,

http://www.abc.com/LCID/Excel74.html  should resolve to http://www.abc.com/Excel.aspx?LCID=74

And
http://www.abc.com/kw/DBHDI.html. should resolve to http://www.abc.com/Outpage.aspx?Kw=DBHDI

Thats all what is required. Please suggest.
Thanks



__________________
Senior Software Engineer,
Orient Technologies,
http://www.orientindia.biz
Back to Top Visit deepak102ind's Homepage
 
Lexey
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Posts: 8119
Posted: 20 April 2006 at 7:39pm  

RewriteRule /LCID/Excel(\d+)\.html /Excel.aspx\?LCID=$1 [I,L]
RewriteRule /kw/(^./?]+)\.html /outpage.aspx\?Kw=$1 [I,L]
Back to Top
 
deepak102ind
Newbie


Joined: 18 February 2006
Location: India
Posts: 22
Posted: 20 April 2006 at 11:07pm  

Something strange.

After I tried the suggestions, any URl that has .html in it, does not woeks. But .aspx does works. That is

http://localhost/SEO/DAGHB.html will not work. It returns HTTP 404 - File not found.

But if I try http://localhost/SEO/DAGHB.aspx, that will work.

Following is there in the ini file

RewriteRule (/[^-]+)-([^.]+\.html) $1%20$2 [N,I]
RewriteRule /([^.]+)\.html /seo/outpageecallCenterOnline.aspx\?ckeyword=$1 [I,L]

This had always worked earlier. Any ideas?

Thanks,



__________________
Senior Software Engineer,
Orient Technologies,
http://www.orientindia.biz
Back to Top Visit deepak102ind's Homepage
 
Lexey
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Posts: 8119
Posted: 23 April 2006 at 11:16am  

Do you have other rules?
Back to Top
 
deepak102ind
Newbie


Joined: 18 February 2006
Location: India
Posts: 22
Posted: 23 April 2006 at 9:11pm  

No nothing except

# Defend your computer from some worm attacks
RewriteRule .*(?:global.asa|default\.ida|root\.exe|\.\.).* . [F,I,O]

 



__________________
Senior Software Engineer,
Orient Technologies,
http://www.orientindia.biz
Back to Top Visit deepak102ind's Homepage
 
deepak102ind
Newbie


Joined: 18 February 2006
Location: India
Posts: 22
Posted: 24 April 2006 at 5:37am  

Hi,

Please ignore the previous comment. It seems working now. However the original issue still remains.

I now have the following in my ini file.

RewriteRule /LCID/Excel(\d+)\.html /Excel.aspx\?LCID=$1 [I,L]
RewriteRule /kw/(^./?]+)\.html /outpage.aspx\?Kw=$1 [I,L]

Once again I want to tell you, this does not works. I still get 404 page not found. I am not sure why is it going so complicated. Other then taking time, all my websites are half functional and I may suffer my ranking if I have the search engines visiting back.

Let me tell you the history again so you can think of it and suggest me.

I have a page named outpage.aspx.
I can have the following combinatins for outpage.aspx

1. http://www.abc.com/outpage.aspx

2. http://www.abc.com/abcdef.html
In this case the url must be rewritten as http://www.abc.com/outpage.aspx?ckeyword=abcdef

Then I have another page named excel.aspx. Following are the possible combinations

1.http://www.abc.com/excel.aspx
2.http://www.abc.com/excel21.html
This should be rewritten as http://www.abc.com/excel.aspx?LCID=21

you see, I have no subdirectories.
All this happens on the base url itself. The previous rules you gave me have a subfolder there.

RewriteRule /LCID/Excel(\d+)\.html /Excel.aspx\?LCID=$1 [I,L]
RewriteRule /kw/(^./?]+)\.html /outpage.aspx\?Kw=$1 [I,L]

I tried to remove the subfolder and tryied the following too

RewriteRule /Excel(\d+)\.html /Excel.aspx\?LCID=$1 [I,L]
RewriteRule /(^./?]+)\.html /outpage.aspx\?cKeyword=$1 [I,L]

here too I receive 404.

Please let me know what can be done to resolve this issue. Please indicate if you can chat on msn or yahoo messangers so we can fix this issue immediately.

Look forward to your reply,
Good wishes,



__________________
Senior Software Engineer,
Orient Technologies,
http://www.orientindia.biz
Back to Top Visit deepak102ind's Homepage
 
Lexey
Moderator Group


Joined: 15 August 2002
Location: Russian Federation
Posts: 8119
Posted: 25 April 2006 at 4:11pm  

Ops, there was a typo in the 2nd rule. Try this:

RewriteRule /Excel(\d+)\.html /Excel.aspx\?LCID=$1 [I,L]
RewriteRule /([^./?]+)\.html /outpage.aspx\?cKeyword=$1 [I,L]

If it still will not work check file system permissions on the httpd.ini file.
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