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: Url rewrite with conditions
Author
Message |
hades666
Newbie


Joined: 27 July 2010
Posts: 6
Posted: 27 July 2010 at 4:16pm

Hi,

I have this rule

RewriteCond Host: ^domain\.com
RewriteRule (.*) http://domain2.com/page/index.aspx [I,RP]

which works fine.

Now under http://domain2.com i have  a URI /page/admin

How can i have the rules write as follows

domain.com to http://domain2.com/page/index.aspx

domain.com/admin to http://domain2.com/page/admin

Hope you can assist

Hades666

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 28 July 2010 at 3:22am

Please try the following config:

RewriteCond Host: domain\.com
RewriteRule /(?:admin)? http://domain2.com/page/(?1admin:index.aspx) [I,RP]

__________________
Regards,
Anton
Back to Top
 
hades666
Newbie


Joined: 27 July 2010
Posts: 6
Posted: 28 July 2010 at 8:02am

Hi Anton,

Thanks for the reply but it didn't work :( Here is a better way of explaining it hopefully.

The primary URL is domain.com with multple files and sub directories. I need all subs to be redirected EXCEPT /admin/ since that needs to be redirected to another location.

ex:

# URL is domain.com/* EXECEPT domain.com/admin/*

RewriteCond Host: ^domain\.com            #domain.com
RewriteCond %{REQUEST_URI} !^/admin/ #URI != /admin
RewriteRule (.*) http://domain2.com/page/login.aspx [I,RP]

# URL is domain.com/admin

RewriteCond Host: ^domain\.com            #domain.com
RewriteCond %{REQUEST_URI} ^/admin/  #URI = /admin
RewriteRule (.*) http://domain2.com/page/admin/user_login.asp [I,RP]

Does this clarify?

Hades666

Back to Top
 
Anton
Admin Group


Joined: 30 January 2007
Location: Ukraine
Posts: 10519
Posted: 29 July 2010 at 2:52am

Thanks for the explanation.
Then I guess this might help you:

RewriteCond Host: domain\.com
RewriteRule /(?!admin)(.*) http\://domain2.com/page/login.aspx [I,RP]

RewriteCond Host: domain\.com
RewriteRule /admin.* http\://domain2.com/page/user_login.aspx [I,RP]

__________________
Regards,
Anton
Back to Top
 
hades666
Newbie


Joined: 27 July 2010
Posts: 6
Posted: 29 July 2010 at 7:30am

That worked beautifully!!

Thanks Anton,

Hades666

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