ISAPI temp redirect in IIS

Topics: Developer Forum, User Forum
May 13, 2009 at 8:18 PM

Hi all,

 

My server is a IIS server. currently we are working with ISAPI for our redirects.

 

So, I am trying to do a temporary redirect, to do like a mask to the URL, so the internet user will see in the URL www.mydomain.com/page.html, but really in the back what is pointing is to www.mydomain.com/something/page.html

So, instead of using [R=301] I am only putting [R], like this:

RedirectRule ^.*mydomain\.com/page\.html$ http://www.mydomain.com/something/page.html [R]

This is the only redirect rule in my ISAPI file that is not working, all the other redirects ([R=301]) are working without a problem.

 

regards,

Coordinator
Jul 6, 2009 at 7:04 PM

In a RedirectRule, you cannot match on the host name.  Check the readme.  You need to match on the URL after the hostname, only.

If you need to take action that depends upon the value of the host (www.domain.co.uk) , then you should use a RewriteCond with the appropriate server variable (%{SERVER_NAME} or %{HTTP_HOST}).

example

RewriteCond %{SERVER_NAME}    ^www\.domain\.com$
RedirectRule ^/(.*)$           http://newserver.domain.com/$1  [L]
Jul 15, 2009 at 6:01 PM

Hi Friends

  i am facing a problem in iirf .Actually i am new in iirf so please help me in iirf

 My problem is i have used iirf for  url rewriting and we need to implement  301 redirect  for this

But when i used redirect rule for this it's not working below i have write a code for this

 

RedirectRule   /catlog.aspx?Pagename=Satisfaction+Guarantee       /Satisfaction_Guarantee.aspx   [r=301]

 

Please help me how it's work

 

and also one more question if user direct insert  url so  it's redirect new rewriting url or not  ??

 

Please give me answer my question

 

 

 

 

 

 

 

Coordinator
Jul 15, 2009 at 6:45 PM

Sorry, I don't understand your problem.

You wrote that you are having a problem, but then you did not say what the problem IS.

You need to describe:  the results you are expecting, and the results you observe.

 

 

Jul 16, 2009 at 3:19 AM

Actually for Seo Puprose

i need to 301 redirect my some old url to new one for  Seo
  new url is rewrite url of old one.


 this is our old url /catlog.aspx?pagenmae=discounts

and discounts.aspx is our rewrite url

but /catlog.aspx?pagenmae=discounts  have a indexing in google seo


so we need when some enter  www.domain.com/catlog.aspx?pagenmae=discounts  it's directly redirect to  www.domain.com/discounts.aspx

and return 301 status code

please tell us

Below a sample which i uesd in my ini file


redirect /catlog.aspx?pagenmae=discounts                www.domain.com/discounts.aspx [r=301]


i have write a code but it's not working 


Please tell me

Coordinator
Jul 16, 2009 at 6:27 AM
Edited Jul 16, 2009 at 6:42 AM

ok, I think you want to redirect from www.domain.com/catlog.aspx?pagenmae=discounts  to  www.domain.com/discounts.aspx .

    RedirectRule ^/catlog\.aspx\?pagename=discounts$     http://www.domain.com/discounts.aspx  [R=301]

You need uppercase R in the {R=301]. Your previous rule was [r=301], and this will not succeed.

Also, you have spaces in some URLs, (like "Satisfaction+Guarantee" above). In this case, check the IIRF logs to verify that the the incoming URL is using a + for the space.

In general, check the IIRF log for information about the operation of the filter. There are helpful messages in the log.

Jul 16, 2009 at 4:06 PM

Hi Cheeso thanks for reply

I have used above but it's not working in server

below i have used by rewrite code and i need it 301  redirect rule for old pages

if any body know old url and they old url we need redirect to new one .Please help me

RewriteRule  About_us.aspx             /catlog.aspx?Pagename=About+Us [I]
RewriteRule  WhyWeAre1.aspx             /catlog.aspx?Pagename=Why+We+Are+%231 [I]
RewriteRule  Shipping.aspx              /catlog.aspx?Pagename=Shipping [I]

RewriteRule  Return_Policy.aspx         /catlog.aspx?Pagename=Return [I]
RewriteRule  Payment_method.aspx         /catlog.aspx?Pagename=Payment [I]
RewriteRule  Wholesale.aspx             /catlog.aspx?Pagename=Wholesale [I]
RewriteRule  Top_Buyer_Tips.aspx         /catlog.aspx?Pagename=Top+Buyer+Tips [I]
RewriteRule  Privacy_Policy.aspx         /catlog.aspx?Pagename=Privacy+Policy [I]

Thanks and regards

Deepak Chandra

 

 

 

 

 

Coordinator
Jul 16, 2009 at 6:55 PM

If you want a Redirect, then you need to use RedirectRule.    You don't have any RedirectRule in your rule set, therefore IIRF will never REDIRECT any incoming URLs. 

I don't understand when you say "I have tried the above...".   The above was my suggestion to use RedirectRule. But the example you gave did not use RedirectRule at all.

Maybe you should read the fine documentation?  It's very enlightening. If you want to read it offline, there's a .chm file on the downloads page.

Jul 31, 2009 at 3:06 PM

I was wondering if this would be possible because we moved the website to a new server:

Old URL: main.com/old/test/page.asp

New URL: new.com/new/test/page.asp

so when a user tries main.com they would get a static page untouched. However if they user enters main.com/old/test/page.asp I would like to redirect them to new.com/new/test/page.asp. How would the syntax within the ini file look for this?

RewriteRule ^/(.*)$  https://new.com:443/new/$1   [R]

of

RedirectRule ^/(.*)$  https://new.com:443/new/$1   [R]

 

Thanks for the help!

Jul 31, 2009 at 3:53 PM

however if someone types in main.com I would like the user to stay at main.com but if there is any path then I would like to redirect them to that path

Coordinator
Jul 31, 2009 at 5:07 PM

you know, it's nice if you CREATE A NEW THREAD for new questions.

It's helpful for searching, it makes the forums useful to those who come after us.

PLEASE PLEASE PLEASE start a new thread for a new question.

I will respond.   I know it's inconvenient for you.  Your understanding is appreciated.

Jul 31, 2009 at 5:09 PM

Got it!

RedirectRule ^/old(.*)$  https://new.com/new$1   [R=302]