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: rewrite everything except one page
Author
Message |
Bigor
Newbie


Joined: 06 March 2008
Location: Canada
Posts: 12
Posted: 22 September 2011 at 11:54am

Hi guys,

Could you help me with one rule please?

I need to rewrite everything except one page (default.aspx) to the same  default.aspx page.

this

RewriteRule /.* default.aspx [RP,I,L]

give me a loop. How can I implement 'except' part?

Thanks

 

 

Back to Top
 
Bigor
Newbie


Joined: 06 March 2008
Location: Canada
Posts: 12
Posted: 22 September 2011 at 12:41pm

sorry, i forgot to mention that I need permanent redirect all pages (except default.aspx) to the default.aspx

when i did this

RewriteRule /default.aspx /default.aspx [I,L]

RewriteRule /.* /default.aspx [RP,L]

i lost all all styles and graphics

 

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 23 September 2011 at 2:19am

Please try to have the following instead:

RewriteRule /(?!default\.aspx).* http\://www.yoursite.com/default.aspx [I,RP]

__________________
Regards,
Anton
Back to Top
 
Bigor
Newbie


Joined: 06 March 2008
Location: Canada
Posts: 12
Posted: 23 September 2011 at 10:32am

Thank you, Anton... but I've lost graphics and style again with your rule.

I am using these rules rigth now

RewriteRule /default.aspx /default.aspx [I,L]

RewriteRule /.*\.htm /default.aspx [RP,L]

RewriteRule /.*\.html /default.aspx [RP,L]

RewriteRule /.*\.asp.* /default.aspx [RP,L]

RewriteRule /.*\.aspx.* /default.aspx [RP,L]

 but prefer to have some elegant solution

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 26 September 2011 at 4:23am

Please try to have it the following way:

RewriteRule /(?!(?:default\.aspx|.*\.(?:jpe?g|bmp|gif|css|js|etc))).* http\://www.yoursite.com/default.aspx [I,RP]

__________________
Regards,
Anton
Back to Top
 
Bigor
Newbie


Joined: 06 March 2008
Location: Canada
Posts: 12
Posted: 26 September 2011 at 10:44am

it works perfect. thank you!
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