| Author |
|
deepak102ind Newbie

Joined: 18 February 2006 Location: India
Online Status: Offline Posts: 22
|
| Posted: 18 April 2006 at 4:14am | IP Logged
|
|
|
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 |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7598
|
| Posted: 18 April 2006 at 5:19pm | IP Logged
|
|
|
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
Online Status: Offline Posts: 22
|
| Posted: 18 April 2006 at 11:52pm | IP Logged
|
|
|
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 |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7598
|
| Posted: 19 April 2006 at 4:17pm | IP Logged
|
|
|
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.
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
Online Status: Offline Posts: 22
|
| Posted: 19 April 2006 at 9:33pm | IP Logged
|
|
|
======================== 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 |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7598
|
| Posted: 20 April 2006 at 7:39pm | IP Logged
|
|
|
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
Online Status: Offline Posts: 22
|
| Posted: 20 April 2006 at 11:07pm | IP Logged
|
|
|
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 |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7598
|
| Posted: 23 April 2006 at 11:16am | IP Logged
|
|
|
Do you have other rules?
|
| Back to Top |
|
| |
deepak102ind Newbie

Joined: 18 February 2006 Location: India
Online Status: Offline Posts: 22
|
| Posted: 23 April 2006 at 9:11pm | IP Logged
|
|
|
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 |
|
| |
deepak102ind Newbie

Joined: 18 February 2006 Location: India
Online Status: Offline Posts: 22
|
| Posted: 24 April 2006 at 5:37am | IP Logged
|
|
|
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 |
|
| |
Lexey Moderator Group

Joined: 15 August 2002 Location: Russian Federation
Online Status: Offline Posts: 7598
|
| Posted: 25 April 2006 at 4:11pm | IP Logged
|
|
|
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 |
|
| |