How to redirect any user to the same source url

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 16
Joined: 29 Apr 2013, 08:10

How to redirect any user to the same source url

30 Jul 2013, 14:23

Hi,

I have to redirect users to the specific page which have some code behind logic and if logic does not fulfill the condition then user should land to the requested page without being redirected. Ex:

If user requests for "https://bt.bev.com/sites/site1/site2" then it should redirect to "https://ct.cev.com/custom.aspx" (this page has some custom logic which need to be fulfilled); if logic does not support then user must be land to the requested URL.

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: How to redirect any user to the same source url

30 Jul 2013, 15:30

Hello,

Please, try using the following:

Code: Select all
RewriteEngine on
RewriteBase /

RewriteCond %{HTTPS} on
RewriteCond %{HTTP:Host} ^bt\.bev\.com$ [NC]
RewriteRule ^sites/site1/site2$ https://ct.cev.com/custom.aspx [NC,R=301,L]


Regards
Andrew

User avatar
Posts: 16
Joined: 29 Apr 2013, 08:10

Re: How to redirect any user to the same source url

31 Jul 2013, 02:01

Thanks for your reply...

I have to include "RewriteCond %{HTTPS} on" line with each rule or only once in the httpd config file?

And, as i mentioned that I have to redirect user to the back requesting URL (https://bt.bev.com/sites/site1/site2) without being redirected again if custom.aspx does not support logic. So, do we have any kind of mechanism to achieve that?

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: How to redirect any user to the same source url

31 Jul 2013, 08:51

Hello,

Each condition applies only to one rule. So in this case verification whether this request is going through SSL is applied only to this rule.

I'm sorry, whould you please, clarify if we are talking about redirects between these two pages? or is it proxying? Or simple rewriting? What kind of "logic" did you refer to?

Regards
Andrew

User avatar
Posts: 16
Joined: 29 Apr 2013, 08:10

Re: How to redirect any user to the same source url

01 Aug 2013, 14:06

Here we are talking about the reverse redirection, first we have to redirect from URL A to B then B to A without being redirected to B again...

User avatar
Posts: 1264
Joined: 07 Mar 2012, 10:16

Re: How to redirect any user to the same source url

01 Aug 2013, 14:39

Well you got the redirect. The proxying example would be:

Code: Select all
RewriteCond %{HTTPS} on
RewriteCond %{HTTP:Host} ^ct\.cev\.com$ [NC]
RewriteRule ^custom\.aspx$ https://bt.bev.com/sites/site1/site2 [NC,P,L]


However, I'm not quite sure how this would work with your "logic" that needs to be fulfilled.

Regards
Andrew

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 17 guests