Quantcast
Channel: URL Rewrite Module
Viewing all 2482 articles
Browse latest View live

Rewrite not working, when using redirect works

$
0
0

I am currently trying to rewrite

http://www.my-site.com/test.test/test.test

to

http://www.my-site.com/index.cfm/test.test/test.test

however, rewriting is not working correctly. It will not send the test.test/test.test along, it just goes to index.cfm. (although it does state that it is actually going to index.cfm/test.test/test.test in the Failed Request Tracing log) Our ColdFusion application is simply not receiving it, and that cannot be due to our application, since if I change the rule to a 301 redirect (keeping everything else the same), it works perfectly fine.

This is the rule:

<rule name="Everything to event handler" enabled="true" stopProcessing="true"><match url="^(.*)$" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false"><add input="{PATH_INFO}" pattern="^.*(index.cfm).*$" negate="true" /></conditions><action type="Rewrite" url="/index.cfm/{R:1}" appendQueryString="true" logRewrittenUrl="true" /></rule>


Using IIS 7.5 with Rewrite Module 2 and ColdFusion 10 Update 11.


ARR, Trailing Slash and HTTPS

$
0
0

Hi,

Here is my setup

LB01 is running IIS with ARR installed.

I have created a farm in ARR that includes WEB01 and WEB02

WEB01 and WEB02 have IIS installed and my web app configured as an application.

The website on LB01 is only available publicy via HTTPS

The website on WEB01 and WEB02 are available privately via HTTP

On LB01 at server level, I have created the following server level rule to route requests for me.mydomain.com to my server farm

<rule name="Redirect for me.mydomain.com">
<match url=".*" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^me\.mydomain\.com$" />
</conditions>
<action type="Rewrite" url="http://VIP-me.mydomain.com/{R:0}" />
</rule>

Now if I go to https://me.mydomain.com/myapp/ it works fine and routes traffic to http://web01/myapp/ or http://web02/myapp/

It didn't work when using https://me.mydomain.com/myapp (without the trailing slash) so I added the following rule at site level on LB01 to append the trailing slash.


<rule name="AddTrailingSlashRule1" stopProcessing="true">
<match url="(.*[^/])$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}/" />
</rule>

This is appending the trailing slash but unfortunately it redirects from https to http which isn't accessible.

So the problem I have is with the two rules aboove when I go to https://me.mydomain.com/myapp I get redirected to http://me.mydomain.com/myapp/

I've tried adding the following force HTTPS rule both at server and site level but these do not resolve the issue.

<rule name="Force HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions><add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" />
</rule>

Not sure whether this isn't working because I've set it up wrong or because the rule isn't being triggered because http isn't accessible.


Your help would be appreciated.

Thanks,

P

How can I disable a URL Rewrite Rule using a Powershell Command?

$
0
0

Hello,

I am aware that there is a solved forum entry. But since the solution does not work for me I have to open a new thread. I am afraid the other one isn't looked at anymore since it is published as solved.
This is the thread:
http://forums.iis.net/t/1173635.aspx/1?Scripting+Url+Rewrite+Rules+with+WebAdministration

It says there:    You can also disable your rules by the command like:

Set-WebconfigurationProperty '/system.webserver/rewrite/rules/rule[@name="YourRuleName"]' -Name enabled -Value false

I tried to de-activate a rewrite rule on my server on the Default Web Site with the name "Redirect from blog" using your command above - no luck:

Set-WebconfigurationProperty '/system.webserver/rewrite/rules/rule[@name="Redirect from blog"]' -Name enabled -Value false

Instead, I get the following error message:

WARNING: Target configuration object '/system.webserver/rewrite/rules/rule[@name="Redirect from blog"] is not found at path 'MACHINE/WEBROOT/APPHOST'.

Do you have an idea of what went wrong?
Obviously the rewrite rule is not where the system expects it. Where would I have to search for it or what in the command would I have to adapt?

There are only a few sites on my machine and the rule that I want to disable is on the "Default Web Site".

Thank you and regards

Andi

 

Help needed to configure URL rewrite / redirection

$
0
0

Hi,

Need some advice to configure URL redirection at via IIS reverse proxy. In our current scenario we have web server in our internal network.  Now we have configured a IIS server at DMZ zone with ARR 2.5 installed. The main purpose of that IIS server to play as reverse proxy. We have not configured any web server on that IIS server. It runs with its basic web server. We want that url would be able to access as following.

www.rproxyCompany.com/track  ---> IIS reverse proxy should rewrite -->http://servera.company.local/trackerurl/home.seam

We had just enabled Proxy and created a Rule on URL rewrite module. After URL rewrite we can see our internal webpage with different layout and its seems not working at all.  When we change from REWRITE to REDIRECT then we can see actual webpage but also its displaying actual host name ! Which we would not like to publish!

Any help would be really appreciate.

 

 

Rule to rewrite hostname not working :(

$
0
0

Hello folks, I am having an issue trying to rewrite an URL.

This is the scenario.  I have a new website that is replacing an old website (each one in a separate server).  The new site is up and running and we want to redirect users that are still going to the old website to the new site.  So we changed DNS of the old site to point to the IP of the new site.  However, we want to rewrite the old hostname in the URL to the new hostname we are using for the new site. 

newsite.mylcl.lan oldsite.mylcl.lan

The new site is running IIS 7.5 and I installed URL Rewriter 2.0 without any problems. 

I have tried this using rewrite and redirect rules, none of them are working, here are the two rules I have tried:

REDIRECT RULE

<system.webServer>         <rewrite>             <rules>                 <rule name=”Redirect” stopProcessing=”true”>                     <match url=”.*” />                     <conditions>                         <add input=”{HTTP_HOST}” pattern=”^oldsite.mylcl.lan$” />                     </conditions>                     <action type=”Redirect” url=”http://newsite.mylcl.lan/{R:0}” redirectType=”Permanent” />                 </rule>             </rules>          </rewrite>     </system.webServer>

 

REWRITE RULE

 <system.webServer>         <rewrite>             <rules>                 <rule name="Rewrite" enabled="true" stopProcessing="true">                     <match url=".*" />                     <conditions>                         <add input="{HTTP_HOST}" pattern="^oldsite.mylcl.lan$" />                     </conditions>                     <action type="Rewrite" url="http://newsite.mylcl.lan/{R:0}" appendQueryString="false" />                 </rule>            </rules>

        </rewrite>

When it comes to regular expressions, I am an ignorant, so I am pretty sure I got something wrong here.  However, I based these rules on some examples I found on the Internet.

Most of the examples I found are instruction on how to rewrite an URL for the same website, so the hostname of the URL is not rewriten/touched at all.  But as you can see, in my case, what I need to rewrite is the hostname.

I really appreciate your help on this issue, I have been going crazy and don' know where else to look on how to accomplish this.

Thanks!

Url rewrite situation

Root file is in Subdirectory of Physical Path

$
0
0

It's my test domain. Used a web builder to make a site and now uploaded to my server.

Used http redirect to make domain.com point to domain.com/tersxxxxxxxxx.webs.com which is where index.html is housed.

Index.html is located in domain.com/tersxxxxxxxxx.webs.com/

Example 1: domain.com/tersxxxxxxxxx.webs.com/ to display domain.com/

Example 2: domain.com/tersxxxxxxxxx.webs.com/about-us.html ---> domain.com/about-us.htm
Haven't used URL Rewrite before

ARR in Virtual Directory redirect to domain root

$
0
0

Hello, I have a web application running on port 9090 and want to acces it over IIS on port 80.
Here is my current rule for the Application "myapp":

<rules><rule name="ReverseProxyInboundRule1" stopProcessing="true"><match url="(.*)" /><conditions><add input="{CACHE_URL}" pattern="^(https?)://" /></conditions><action type="Rewrite" url="{C:1}://localhost:9090/{R:1}" /></rule></rules>

If I now browse to "http://myserver/myapp" I get redirected (HTTP 302) to "http://myserver/login".
The right URL would be "http://myserver/myapp/login" (if I browse this page I see the site but wihtout any stylesheets or graphics becouse they are also all wrong linked to the root).

The "myapp" Application lifes under the "Default Web Site" becouse only only one Subdomain is pointing to this server.

How can I fix this behavior?


Remotely rewrite gives 404

$
0
0

Hello,

I'm using IIS 7.5 and URL Rewrite 2.0 and a simple rewrite rule works locally but not remotely.

<rule name="RewriteUserFriendlyURL1" enabled="false" stopProcessing="true"><match url="^test$" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /></conditions><action type="Rewrite" url="test.php" /></rule>

I was reading this tutorial http://www.iis.net/learn/extensions/url-rewrite-module/user-friendly-url-rule-template and just created a rule like:

www.domain.com/test
should be rewritten to
www.domain.com/test.php

And it works when I request www.domain.com/test locally: test.php is shown.
But when requesting remotely from my browser at home, I get a 404.0 (I enabled detailed errors for that moment):

Module    IIS Web Core
Notification    MapRequestHandler
Handler    StaticFile
Error Code    0x80070002
Requested URL    http://www.domain.com:80/test/
Physical Path    C:\inetpub\www\domain\test\
Logon Method    Anonymous
Logon User    Anonymous

So it seems the rewrite rule has no effect when the request comes from "outside". Why is that?

Thanks!

Rewrite to stop page being access via https

$
0
0

I only want specific pages of my site to be accessed via https - I don't want others being able to be indexed by search engines via both http and https to prevent any duplicate content issues.

Is there a way in IIS7 to stop this? I did create a rewrite rule that was looking for {HTTPS} to be on, and where request does not match "/secure/" but that breaks all CSS / Images / Javascript on secure pages.

<rule name="HTTPS to HTTP" enabled="false" stopProcessing="true"><match url="(.*)" /><conditions logicalGrouping="MatchAll" trackAllCaptures="false"><add input="{URL}" pattern="/secure/" negate="true" /><add input="{HTTPS}" pattern="on" /></conditions><action type="Redirect" url="http://{HTTP_HOST}/{REQUEST_URI}" /></rule>



There must be an easy way to do this? I just can't wrap my head round what I need to ask it to do!

Thanks

No longer available from the outsize world

$
0
0

In order to be able to use the Visual-SVN server, I installed ARR and used url-rewrite.

 

Our domain is www.mydomain.nl  , And from the outside world we use that to get to the site and outlook web access.

We added a new subdomain to DNS : svn.mydomain.nl and we want to use this to route via IIS our subversion to the VisualSVN server. We added the rewrite section as described below. And indeed we can reach our subversion from the outside world.

But we can no longer reach anything else from the outside world, not the www.mydomain.nl neither https://www.mydomain.nl/owa

Both result in an error 500 (even when the browser has more specific errors turned on). We have FailureRequestTracing turned on for everything at the highest level. But don't see any Failures appearing in the directory. Strange enough when you try these two url's on the IIS server itself, the sites are reachable . Removing the URL REWRITE section makes the site available to the outside world again.

On the side, we also see Application REquest Failures in the log directory, of which we have no idea why it is considered a failure at all. There is no message in such traces indicates an error / warning at all, they all resulted in Code 200. So why are they in the log?

Any help with expecially the first problem would be appreciated.

 

Thanks

 

 

 

<system.webServer>  

<rewrite>            

<outboundRules>                

<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1" stopProcessing="true">                    

<match filterByTags="A, Form, Img" pattern="^http(s)?://svnserver.mydomain.nl(.*)" />                    

<action type="Rewrite" value="http{R:1}://svn.mydomain.nl{R:2}" />                

</rule>                

<preConditions>                    

<preCondition name="ResponseIsHtml1">                        

<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />                    

</preCondition>                

</preConditions>            

</outboundRules>            

<rules>                

<rule name="ReverseProxyInboundRule1" stopProcessing="true">                    

<match url="(.*)" />                    

<conditions>                        

<add input="{CACHE_URL}" pattern="^(https?)://svn.mydomain.nl" />                    

</conditions>                    

<action type="Rewrite" url="{C:1}://svnserver.mydomain.nl:8443/{R:1}" logRewrittenUrl="true" />                

</rule>            

</rules>  

</rewrite>  

</system.webServer>

Redirect to a internal server & port

$
0
0

Hi people! 

I'm setting up a server that the application needs a redirect to a specific location (because the page isnt in the same host as the IIS, its in another host in my internal lan and running in an specific port). 

Here its the example:

The request on the internet comes from: 

http://www.myserver.com/NEWAPPLICATION/  

and i need that IIS do a internal handling operation with this page (and whatever sub-internal directories have) like this (this will be the internal request:)

http://10.1.1.99:1111/

And whats the problem? That when i do this, the external client (that obviusly dont have access to my internal lan), cant connect to it, because the HTTP Redirection in IIS its explicit

I need that instead of showing the internal IP:port, the IIS go and handle the operation like itself and shows it in the common 80 port that i have public, and also, all the relative sub-sites, go to the same place.


Like if a user types:

http://www.myserver.com/NEWAPPLICATION/subdirectory/index.html


Internally the iis handle this and do a internal request to this another internal server (that obviusly has local connection, no firewalls between this IIS and "newapplication" server


http://10.1.1.99:1111/subdirectory/index.html


This its that all /NEWAPPLICATION/ requests always go to this http://10.1.1.99:1111/  server.

I really think that its so easy to do, but really, after some hours searching, i dont have a good answer to this, because all that i see about redirects, shows external adresses, and no internal redirects.

I'm working with Windows Server 2008 R2, IIS7 and i have the Redirect HTTP IIS feature installed.

Thank you very much for your help!

ARR in Virtual Directory redirect to domain root

$
0
0

Hello, I have a web application running on port 9090 and want to acces it over IIS on port 80.
Here is my current rule for the Application "myapp":

<rules><rule name="ReverseProxyInboundRule1" stopProcessing="true"><match url="(.*)" /><conditions><add input="{CACHE_URL}" pattern="^(https?)://" /></conditions><action type="Rewrite" url="{C:1}://localhost:9090/{R:1}" /></rule></rules>

If I now browse to "http://myserver/myapp" I get redirected (HTTP 302) to "http://myserver/login".
The right URL would be "http://myserver/myapp/login" (if I browse this page I see the site but wihtout any stylesheets or graphics becouse they are also all wrong linked to the root).

The "myapp" Application lifes under the "Default Web Site" becouse only only one Subdomain is pointing to this server.

How can I fix this behavior?

Remotely rewrite gives 404

$
0
0

Hello,

I'm using IIS 7.5 and URL Rewrite 2.0 and a simple rewrite rule works locally but not remotely.

<rule name="RewriteUserFriendlyURL1" stopProcessing="true"><match url="^test$" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /></conditions><action type="Rewrite" url="test.php" /></rule>

I was reading this tutorial http://www.iis.net/learn/extensions/url-rewrite-module/user-friendly-url-rule-template and just created a rule like:

www.domain.com/test
should be rewritten to
www.domain.com/test.php

And it works when I request www.domain.com/test locally: test.php is shown.
But when requesting remotely from my browser at home, I get a 404.0 (I enabled detailed errors for that moment):

Module    IIS Web Core
Notification    MapRequestHandler
Handler    StaticFile
Error Code    0x80070002
Requested URL    http://www.domain.com:80/test/
Physical Path    C:\inetpub\www\domain\test\
Logon Method    Anonymous
Logon User    Anonymous

So it seems the rewrite rule has no effect when the request comes from "outside". Why is that?

Thanks!

Prevent URL rewrite in pages

$
0
0

Hi,

How can I prevent IIS from rewriting link URLs in my PHP/HTML pages? I am currently using rewrite rules to redirectwww.mydomain.com/en/PageName towww.mydomain.com/page.php?page=PageName&lang=en. It works fine, the problem is that IIS rewrites all URLs links inside the page that the Web server is pushing to the client. For example, href="en/PageName" is being rewritten in href="en/en/PageName", which causes redirection to fail. I know I could only put href="PageName" so IIS would rewrite it in href="en/PageName". However by doing this my website becomes dependant on the redirection policies, and accessing a page directly by it's "non-clean" URL (www.mydomain.com/page.php?page=PageName&lang=en) will cause all links to fail, because accessing an URL that way, IIS will not do any rewriting.

Basically, I only want to enable nice URLs without IIS messing up with the links inside the web pages... Is is possible to do so?

Thank you!


URL rewrite is loosing my webpage layout !!!

$
0
0

Hi,

I am new to IIS world. We have a requirement to use IIS as reverse proxy. I have managed to create a inbound rule to rewrite the url and it seems to be working fine. Unfortunately when I access that url via reverse proxy it looses all the layout.

I am assuming I need to create a proper outbound rule to overcome this issue. Need your help on it.

Basically my scenario is as follows.

- I want user to access http://internal.mycompany.com/track which will redirect them to other web serverhttp://servera.internal.local/trackme/home.seam

My inbound rules was as follows.

  Name : tarck     Pattern : ^track/    Condition : HTTP_HOST  Pattern : internal.mycompany.com

  Action Type : Rewrite      Rewrite URL: http://servera.internal.local/trackme/home.seam

 

Reverse proxy requests to subdirectory

$
0
0

I've literally been fighting this configuration for days and can't figure out why I can't get this to work:

I need a reverse proxy in place to mitigate cross domain scripting security concerns.  Simply put, I want to do this:

-Take any requests made to http://localhost/APP and proxy them to http://app.mysite.com/APP so there are no cross domian issues and everything looks like it's running on the same site.  In theory this should be extremely easy to do - not sure what I could be messing up.

Here's what I've done so far:

- IIS -> Configure AAR -> Check the 'Enable proxy' checkbox.  No other changes here.
- On the website, create a rewrite rule:  

<rule name="Proxy">
     <match url="^localhost/APP/(.*)" />
     <action type="Rewrite" url="http://app.mysite.com/APP/{R:1}" />
</rule>


Now, when I navigate to http://localhost/APP/Interface.aspx I would expect to be proxy'd to http://app.mysite.com/APP/Interface.aspx.  However, I'm instead left with a 404 error.

Thanks for any help!

Root file is in Subdirectory of Physical Path

$
0
0

It's my test domain. Used a web builder to make a site and now uploaded to my server.

Used http redirect to make domain.com point to domain.com/tersxxxxxxxxx.webs.com which is where index.html is housed.

Index.html is located in domain.com/tersxxxxxxxxx.webs.com/

Example 1: domain.com/tersxxxxxxxxx.webs.com/ to display domain.com/

Example 2: domain.com/tersxxxxxxxxx.webs.com/about-us.html ---> domain.com/about-us.htm
Haven't used URL Rewrite before

Pass parameters from url iis 7

$
0
0

Hi ,

I have simple web page that contains two frames.

each frame opens new url on one of my local servers in the lan.

by adding var to the main url the ursl should open.

but IIS7 does not pass them.

Example: url - http://myserver/web.html?id=123

The frames sould open : http://other_server?id=<value of id above>#tab2

it doesnt work.

Need help.

Thanks.

Rewrite from subfolder to external URL

$
0
0

I followed this article but am finding I am unable to get this working using a single instance of IIS.

http://www.iis.net/learn/extensions/url-rewrite-module/reverse-proxy-with-url-rewrite-v2-and-application-request-routing

What I am trying to accomplish is create a reverse proxy for 6 subfolders to route to 6 external sites 

Example: 

I want the following to happen -->

http://proxyurl/site1 --> http://proxyurl/external/data/etc

I set this up but what I am getting is a 404 and I cannot seem to figure out what to change or how to get this working. Any/all assistance is welcomed.

Thanks

Viewing all 2482 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>