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
 Helicon Tech : ISAPI_Rewrite 2.x
Subject Topic: rewrite everything except one page Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Bigor
Newbie
Newbie


Joined: 06 March 2008
Location: Canada
Online Status: Offline
Posts: 12
Posted: 22 September 2011 at 11:54am | IP Logged Quote Bigor

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 View Bigor's Profile Search for other posts by Bigor
 
Bigor
Newbie
Newbie


Joined: 06 March 2008
Location: Canada
Online Status: Offline
Posts: 12
Posted: 22 September 2011 at 12:41pm | IP Logged Quote Bigor

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 View Bigor's Profile Search for other posts by Bigor
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 23 September 2011 at 2:19am | IP Logged Quote Anton

Please try to have the following instead:

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

__________________
Regards,
Anton
Back to Top View Anton's Profile Search for other posts by Anton
 
Bigor
Newbie
Newbie


Joined: 06 March 2008
Location: Canada
Online Status: Offline
Posts: 12
Posted: 23 September 2011 at 10:32am | IP Logged Quote Bigor

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 View Bigor's Profile Search for other posts by Bigor
 
Anton
Admin Group
Admin Group


Joined: 30 January 2007
Location: Ukraine
Online Status: Offline
Posts: 10520
Posted: 26 September 2011 at 4:23am | IP Logged Quote Anton

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 View Anton's Profile Search for other posts by Anton
 
Bigor
Newbie
Newbie


Joined: 06 March 2008
Location: Canada
Online Status: Offline
Posts: 12
Posted: 26 September 2011 at 10:44am | IP Logged Quote Bigor

it works perfect. thank you!
Back to Top View Bigor's Profile Search for other posts by Bigor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
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