How to redirect any user to the same source url
6 posts
• Page 1 of 1
- lalitmishra1988
-
- Posts: 16
- Joined: 29 Apr 2013, 08:10
How to redirect any user to the same source url
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.
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.
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: How to redirect any user to the same source url
Hello,
Please, try using the following:
Regards
Andrew
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
- lalitmishra1988
-
- Posts: 16
- Joined: 29 Apr 2013, 08:10
Re: How to redirect any user to the same source url
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?
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?
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: How to redirect any user to the same source url
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
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
- lalitmishra1988
-
- Posts: 16
- Joined: 29 Apr 2013, 08:10
Re: How to redirect any user to the same source url
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...
- HeliconAndrew
-
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: How to redirect any user to the same source url
Well you got the redirect. The proxying example would be:
However, I'm not quite sure how this would work with your "logic" that needs to be fulfilled.
Regards
Andrew
- 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
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 17 guests