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: redirecting base folder requests?
Author
Message |
rudgr
Newbie


Joined: 10 November 2005
Location: Netherlands
Posts: 34
Posted: 23 September 2010 at 9:03am

Hi,

I'm trying to create redirects like below in my ASP.Net IIS website:

http://www.domain.com/nonexistendirectory > http://www.domain.com/menu/submenu/nonexistentdirectory.aspx

http://www.domain.com/abc123 > http://www.domain.com/menu/submenu/abc.aspx

I want my client to be able to create these kind of redirects himself, so I can't define them beforehand in httpd.ini.

I tried achieving this using a IHttpModule. Unfortunately requests fro http://www.domain.com/abc123 are not handled by .Net (I'm not allowed to configure the wildcard option in IIS)

What I could do is create a physical file: http://www.domain.com/abc123/default.aspx, so http://www.domain.com/abc123 is processed by the IHttpModule.

I'm not really happy with that solution.

What I could think of:

* Create code so that user can manipulate httpd.ini through website (seems risky to me)

* Create a rule in httpd.ini that sends all folder requests to a .aspx file:

RewriteRule /(.*)/ /FolderRewrite.aspx?Folder=$1

Or do you have better solution?

Thanks!
Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 27 September 2010 at 7:39am

If you need the following scenarios to work, please try the following rules:

http://www.domain.com/nonexistendirectory > http://www.domain.com/menu/submenu/nonexistentdirectory.aspx
http://www.domain.com/abc123 > http://www.domain.com/menu/submenu/abc.aspx

RewriteRule /(?!(?:list|of|existing|directories))([^/.])/ /menu/submenu/$1 [I,RP]

P.S. The check for non-existance is much easier in ISAPI_Rewrite 3.

__________________
Regards,
Anton
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