adavir
asked on
ISAPI ReWrite
Hi I am using ISAPI Rewrite
What rule should i specify to change
/viewArticle.aspx?ArticleI d=125
/viewArticle.aspx?ArticleI d=121
/viewArticle.aspx?ArticleI d=122
etc
to
/Article_125.htm
/Article_121.htm
/Article_122.htm
Regards
Paul
What rule should i specify to change
/viewArticle.aspx?ArticleI
/viewArticle.aspx?ArticleI
/viewArticle.aspx?ArticleI
etc
to
/Article_125.htm
/Article_121.htm
/Article_122.htm
Regards
Paul
ASKER
thanks, we cracked it yesterdaty
However we encountered another problem,
Our site has 3 main files in the root directory
viewArticle.aspx?ArticleId = (ID) or (String)
viewArticleCategory.aspx?A rticleCate goryId= (ID) or (String)
viewArticleTopic.aspx?Arti cleTopicId = (ID) or (String)
We have the ISAPI configured like follows
# Helicon ISAPI_Rewrite configuration file
# Version 3.0.0.26
RewriteEngine on
RewriteBase /
# Base Rule
# ARTICLE STUFF
# RewriteRule ^(.*?)\.html /viewArticle.aspx?articleI d=$1 [QSA, NC]
# CATEGORY STUFF
RewriteRule ^[^.]*/[^.]*$ /viewArticleCategory.aspx? ArticleCat egoryId=$0 [NC,QSA]
RewriteRule ^[^.]*/[^.]*/[^.]$ /viewArticleCategory.aspx? ArticleCat egoryId=$0 [NC,QSA]
# TOPIC STUFF
#RewriteRule ^[^.]+$ /viewArticleTopic.aspx?Art icleTopicI d=$0 [NC,QSA]
# RewriteRule ^(?!/admin)/[^\n]*/([^\n]* ).aspx[^.] * /$1.aspx [NC,QSA]
RewriteRule ^[^.]*viewArticle([^\n]*). aspx /viewArticle$1.aspx [NC,QSA]
Our URLs work fine
So a Topic would like as
/OurServices
A category or sub category would work as follows
/OurServices/Tax/Calulatio ns
and an Article would look as follows
/OurServices/Tax/Calulatio ns/Test.ht m
However our Post backs didnt work when the url had a directory out side the root so on post back it would come back with the file /OurServices/Tax/ViewArtic leCategory .aspx could not be found.
So to resolve this we put in the line
RewriteRule ^[^.]*viewArticle([^\n]*). aspx /viewArticle$1.aspx [NC,QSA]
To redirect all request for these files to the root files. BUT in our admin pages we have files of the same name. for instance /admin/contentManager/view Article.as px so when you click on our admin pages you get back to the font end.
so we tried
# RewriteRule ^(?!/admin)/[^\n]*/([^\n]* ).aspx[^.] * /$1.aspx [NC,QSA]
But doesnt work
Any Ideas
Paul
However we encountered another problem,
Our site has 3 main files in the root directory
viewArticle.aspx?ArticleId
viewArticleCategory.aspx?A
viewArticleTopic.aspx?Arti
We have the ISAPI configured like follows
# Helicon ISAPI_Rewrite configuration file
# Version 3.0.0.26
RewriteEngine on
RewriteBase /
# Base Rule
# ARTICLE STUFF
# RewriteRule ^(.*?)\.html /viewArticle.aspx?articleI
# CATEGORY STUFF
RewriteRule ^[^.]*/[^.]*$ /viewArticleCategory.aspx?
RewriteRule ^[^.]*/[^.]*/[^.]$ /viewArticleCategory.aspx?
# TOPIC STUFF
#RewriteRule ^[^.]+$ /viewArticleTopic.aspx?Art
# RewriteRule ^(?!/admin)/[^\n]*/([^\n]*
RewriteRule ^[^.]*viewArticle([^\n]*).
Our URLs work fine
So a Topic would like as
/OurServices
A category or sub category would work as follows
/OurServices/Tax/Calulatio
and an Article would look as follows
/OurServices/Tax/Calulatio
However our Post backs didnt work when the url had a directory out side the root so on post back it would come back with the file /OurServices/Tax/ViewArtic
So to resolve this we put in the line
RewriteRule ^[^.]*viewArticle([^\n]*).
To redirect all request for these files to the root files. BUT in our admin pages we have files of the same name. for instance /admin/contentManager/view
so we tried
# RewriteRule ^(?!/admin)/[^\n]*/([^\n]*
But doesnt work
Any Ideas
Paul
ASKER
PS I know that the rule is commented out
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ASP.NET doesnt allow you to change the Action Attribute, if you do it will default to what it should be. Even using Javascript this cant be accomplished which I found interesting. This highlights the problem in the first place as if .NET generated a fully qualified link for the action i wouldnt have gotten that error.
Regards
Paul
Regards
Paul
RewriteCond %{THE_REQUEST} \ /Article_([0-9]+).htm([^\ ]*)(\?.|\ .)
RewriteCond %{REQUEST_FILENAME} !viewArticle.aspx
RewriteRule . /viewArticle.aspx?ArticleI