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

Outbound rules never work


Url rewrite to work with sub domain

$
0
0

Hello,

I have created a rule like this

<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:8080/appl/{R:1}" />
</rule>
</rules>
<outboundRules>
<rule name="ReverseProxyOutboundRule1" preCondition="ResponseIsHtml1">
<match filterByTags="A, Form, Img" pattern="^http(s)?://localhost:8080/appl/(.*)" />
<action type="Rewrite" value="http{R:1}://appl/{R:2}" />
</rule>

So, when I call localhost/appl it will actually get the content of localhost:8080/appl but the url remains same and they are in full sync.

I mapped localhost to dev.contoso.com and updated it in my hosts file. Now, the requirement is when I try to browse appl.dev.contoso.com it should go to dev.contoso.com/appl and the rule which already exists on appl(application) should launch the application from port 8080. Url should be appl.dev.contoso.com. Can you please help me writing this rule.

Regards,

Vinay

Adding global URL rewrite policy. Would it cause a recycle?

$
0
0

If I add a global URL rewrite policy which would apply to the applicationhostconfig will it:

1) cause a recycle (outage)?

2) take effect immediately?

I have a 4 node IIS ARR Farm and need to make changes on the fly without impacting current sessions.

Thanks.

Redirect unless specfic file is being requested

$
0
0

Hello,

I'm trying to use URL Rewrite to handle this situation, I think it's possible but I'm running into difficulty getting it to do what I want. so this is what I want it to do:

take requests to and redirect them to the same hostname in a different domain, UNLESS it's requesting a specific file. For example:

https://myhost.mydomain.com/app/ redirect to:

https://myhost.newdomain.com/app/  unless the request is for

https://myhost.mydomain.com/app/specialcase.aspx

It seems like I should be able to do this with standard redirects and conditions, but I haven't managed to get it to so far. Is what I'm trying even possible? I could very well be getting the regex wrong, which wouldn't be surprising. I've tried several different approaches which is why I haven't posted a config, but if it's possible I'll try one and then post it if it doesn't work.

Thanks!

Rewrite iis server own hostname

IIS 8 and redirect to another site

Rewrite rules not working. Unsure what the issue is.

$
0
0

Hi folks I have to rewrite hundreds of links and I am already stuck at the start using IIS 7

Within web.config I have the rewrite enabled.  see:

<rewrite><rules configSource="redirects.config" /></rewrite></system.webServer>

The first 3 work but the second wont. Purely because it seems not to be able to read after the .aspx? and I have a few that have like ?fv=43, fv=44, etc that should lead to different pages. 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rules><rule name="Convert to lower case" stopProcessing="true">  <match url=".*[A-Z].*" ignoreCase="false" />  <action type="Redirect" url="{ToLower:{R:0}}" redirectType="Permanent" />  </rule><rule name="Rule 1" stopProcessing="true">  <match url="(.*)default.aspx" />  <action type="Redirect" url="http://www.murrayfarmcare.co.uk/cattle/cattle-medicine/cattle-wormer/3sc.aspx" redirectType="Permanent" />  </rule><rule name="Rule 2" stopProcessing="true"><match url="(.*)..//Cattle/Cattle-Medicines/Cattle-Wormers/2932sc.aspx" /> <action type="Redirect" url="http://www.murrayfarmcare.co.uk/cattle/cattle-medicine/cattle-wormer/3sc.aspx" redirectType="Permanent" />  </rule><rule name="Rule 3" stopProcessing="true"><match url="(.*)cattle/cattle-medicines/cattle-wormers/2932sc.aspx?fv=43;" /> <action type="Redirect" url="http://www.murrayfarmcare.co.uk/cattle/cattle-medicine/cattle-wormer/3sc.aspx" redirectType="Permanent" />  </rule></rules>

Can anyone offer any advice as to you it stops at the ? or how to get it to read the rest? 

Custom rewrite provider - specify more than one parameter

$
0
0

Hi,

maybe my question is very stupid..

How can I specify additional parameters for the custom rewrite provider (stored procedure in my case)?

In all examples I find:

{DBRewriteOldUrls:{R:0}}

what if my stored procedure has three parameters? R:0 will be assigned to the first one.

Thanks


Domain setup on IIS with a folder on different server

$
0
0

Hi

I need urgent help regarding this issue

I have 2 servers. On one of the two servers (A) I have placed content of the domain. The SQL-Sever is also installed on the same

On 2nd server (B) Ive created a domain which is mapped to folder on A using UNC path. With this setup, normal urls are working fine 

eg

http://domain.com/welcome.html or http://domain.com/welcome.asp or http://domain.com/welcome.php

but the urls rewritten with helicon component are not working

eg I have rewritten a url http://domain.com/about.asp as http://domain.com/about

It seems to be due to permission issue

I tried to import the rules from .htaccess to iis but it gives many errors. Also the syntax on IIS ISAPI rewrite is different from that used with helicon. It will be a big exercise for us to migrate the rules. 

Is there any other solution?

YARRE - Yet another rewrite rule error D:

$
0
0

Hello everyone! 

First up apologies in advance, i have read around a bit and looked at other threads and websites documenting the same issue but im still having some issues understanding this all, I was hoping I could get some personalized help c: 

ive been trying to get an image board running on one of my sites, 

and im up to the stage where i figured out the main issue was the package comes with a .htaccess but im running server 2k12 with iis 8.

Heres the original .htaccess file

RewriteEngine On

# Images redirection.
# The following RewriteCond will try to deny any direct linking to images.
# RewriteCond %{HTTP:Referer} ^http://rei.moe/
RewriteRule ^(?:data/)?(preview|sample|jpeg|image)/([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{28})(?:/.*?)?(\.[\w]+)$  data/$1/$2/$3/$2$3$4$5 [L]

# Serve gzipped Stylesheets and Javascripts if mod_headers are enabled.
<IfModule mod_headers.c>
    SetEnv no-gzip
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^(assets/.*)\.css $1\.css\.gz [L,ENV=ASSETSCSS:true] [L]
    Header set Content-Type text/css env=ASSETSCSS
    Header set Content-Encoding gzip env=ASSETSCSS
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^(assets/.*)\.js $1\.js\.gz [L,ENV=ASSETSJS:true] [L]
    Header set Content-Type text/javascript env=ASSETSJS
    Header set Content-Encoding gzip env=ASSETSJS</IfModule>

# Redirect to index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.php [L]

and heres what as far as i can tell the web.config ? 

<?xml version="1.0" encoding="UTF-8"?><configuration><system.webServer><httpErrors><remove statusCode="500" subStatusCode="-1" /><remove statusCode="404" subStatusCode="-1" /><error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" /><error statusCode="500" prefixLanguageFilePath="" path="/500.html" responseMode="ExecuteURL" /></httpErrors></system.webServer><rewrite><rules><rule name="rule 1y" stopProcessing="true"><match url="^(?:data/)?(preview|sample|jpeg|image)/([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{28})(?:/.*?)?(\.[\w]+)$"  /><action type="Rewrite" url="/data/{R:1}/{R:2}/{R:3}/{R:2}{R:3}{R:4}{R:5}"  /></rule><rule name="rule 2y" stopProcessing="true"><match url="^(assets/.*)\.css"  /><action type="Rewrite" url="/{R:1}\.css\.gz"  /></rule><rule name="rule 3y" stopProcessing="true"><match url="^(assets/.*)\.js"  /><action type="Rewrite" url="/{R:1}\.js\.gz"  /></rule><rule name="rule 4y" stopProcessing="true"><match url=".*"  /><action type="Rewrite" url="/index.php"  /></rule></rewrite></configuration>

although its probably hideous xD 

The error I get is 500.19

note: The configuration section 'rewrite' cannot be read because it is missing a section declaration
What declaration do i use ? D: 

I've been wrestling with this darn image board platform for 2 days now so i want to just get it working and forget about it.. haha

any help is appreciated, even if its only a single word c: 

IIS URL rewrite/redirect from one Domain to another?

$
0
0

I am trying to create a rule in redirects.config that allows me to change all urls going from site A to site B. Edited, see below post and just add to redirects.config and ensure you add the bindings in IIS for the sites you are redirecting. (siteA.com ANDwww.siteA.com)

URL Rewite to application.

$
0
0

I have a site setup in IIS.

When i setup the write to go to the application folder instead of the root level that worked fine.

However i just noticed then when calling any other items from within the application folder i get a 404

My rewrite looks like this.

        <rewrite>
            <rules>
                <rule name="rewrite" stopProcessing="true">
                    <match url="^$" />
                    <action type="Rewrite" url="/domainname.com/index.htm" />
                </rule>
            </rules>
        </rewrite>

What i did to test was created two test.htm pages,

The first one i place under the application Put the text test from app

The second one i place under the site
Put the text test from site

When i hit the domainname.com site i see the proper index.htm page
However when i put in domainname.com/test.htm
I see test from site

I should be able to see test from app

I am new to URL Rewrites and it took me forever to figure out how to get the redirect working to the applicaion

If someone could please tell me where i am going wrong and how to fix it i would be very grateful.

Multiple URL redirects use URL rewrite module

$
0
0

Short story question;     What is the best/simplest way to take multiple sites; point them to the IIS server, and redirect them to their respective sites all on the same server.

I have several different websites that I would like to redirect to their respective sites.  examplewww.aaa.com to www.bbb.com andanother websitewww.ccc.com to www.ddd.com/eee.

We have been using an ACE appliance to manage these redirects and want to start to use IIS.  We have 2 IIS server running 7.5.  One is primary and the other backup.  We will eventually use a VIP to manage the load balance of both.

I have changed one website in our DNS server from the old ACE environment to the new IIS server.  I added a rule to rewrite map rules.

Requested URL: Matches the Pattern

Using: Regular Expressions

Pattern: .*

Action: Redirect

Action Properties:  the redirect URL i want the original to go through.

Then I added rewrite maps:  original value: www.aaa.com and new value iswww.bbb.com

I got the aaa.com to redirect to bbb.com both internally and externally.

THEN,,,, I wanted to set up the next website to redirect.  Same settings respectively to its corresponding website.  www.ccc.com to www.ddd.com/eee but now ccc.com is resolving to bbb.com.

outbound rules for custom tags with data-* attributes not working

$
0
0

This is what i'm having trouble with.
The outbound rules that work with regular attributes do not work with custom tags

for example
if i have <img src="/images/misc/something.jpg" data-src="/images/misc/somethingelse.jpg" />

the outbound rule will rewrite this as

<img src="http://mycdn.com/images/misc/something.jpg" data-src="/images/misc/somethingelse.jpg" />

notice that the data-src attribute is not modified even tough my custom tag was supposed to take care of it with the<tag name="img" attribute="data-src" /> part

Similarly

Doesn't work
<li data-bg-img="/Images/splash-screen/splash-home-2.jpg" class="splashli" style="background-color:#e79421;">
Doesn't work
<li class="splashli" style="background-color:#e79421;" imgsrc="/Images/splash-screen/splash-home-2.jpg" >


Works!!!!!!!!
<li imgsrc="/Images/splash-screen/splash-home-2.jpg" class="splashli" style="background-color:#e79421;">
is rewritten as
<li imgsrc="http://mycdn.com/Images/splash-screen/splash-home-2.jpg" class="splashli" style="background-color:#e79421;">

What has changed? i moved the imgsrc attribute from being the last to being the first attribute of the <li> tag.
However notice that this has no effect with attributes that have hyphens. i.e. "data-bg-img"

judging from this post, i'm beginning to think there're some bugs with urlrewrite module and they still haven't been fixed since 2009. Any word on how to fix this? aside from ding filterbytag="none" which is a big performance hit. I've tried failed request tracing and i can't find anything wrong.

here're the outbound rules.

<outboundRules><clear /><rule name="Out_Rewrite_cdn_http" preCondition="ResponseIsHtml" enabled="true" stopProcessing="true"><match filterByTags="A, Img, Link, Script, CustomTags" customTags="imgDataSrc" pattern="^/(Images(?!(/cart-item|/uploads))|Scripts|Styles)/(.*)$" /><action type="Rewrite" value="http://mycdn.com{R:0}" /></rule><preConditions><preCondition name="ResponseIsHtml"><add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /><add input="{URL}" pattern="\.axd.*$" negate="true" /><add input="{URL}" pattern="\.ashx.*$" negate="true" /></preCondition></preConditions><customTags><tags name="imgDataSrc"><tag name="img" attribute="data-src" /><tag name="li" attribute="data-bg-img" /><tag name="li" attribute="imgsrc" /></tags></customTags></outboundRules>

URLRewrite using IIS

$
0
0

Folks, I have spent two days now searching the best way to write a more keyword-rich URL but I have failed miserably.  I am trying to convert  this URL ~/Product.aspx?ProductID=1 to Anniversary-Balloons-d1 when the productID=1 is clicked.  I have explored URLwriter in IIS but I can get it to work.... Any help is appreciated 


rewrite failed , but success when redirect , why ?

$
0
0
<rewrite><rules><rule name="SubDomain Mapping" stopProcessing="true"><match url="(.*)" /><conditions><add input="{HTTP_HOST}" pattern="(^(?!www)\w+)\.ilivecn\.com$" /></conditions><action type="Redirect" url="http://www.ilivecn.com/mall/viewshop?name={C:1}" appendQueryString="false" /></rule></rules></rewrite>

i need to rewrite the url "http://hello.ilivecn.com" to "http://www.ilivecn.com/mall/viewshop?name=hello" , so I wrote the rules. But it just work on Redirect mode,when I set to Rewrite mode, I got the 404 error . why ? 

Requesting assistance making a rule to direct traffic from root of web to folder

$
0
0

I am using Server 2008R2, IIS7.5. I have a dns entry for basetst.tampagov.net which points to the server.  In IIS, I have a website called basetst, and under that is an application called basetst.  I am trying to make a rule which will direct traffic going to basetst.tampagov.net to basetst.tampagov.net/basetst.  I made this and put it in my application host config but it is not working... (this is a vendor product with tons of stuff in the web.config so I was trying to avoid putting it there).

Can you tell if there is a problem with my rewrite or do I have to put it somewhere special in the application host config? I have the urlrewrite module installed and this is the only one so far.

 

 <location path="BaseTst">
        <system.webServer>
              <rewrite>
                    <rules>
                           <rule name="Redirect to Basetst" stopProcessing="true">
                                 <match url=".*" />
                                           <conditions logicalGrouping="MatchAny">
                                           <add input="{HTTP_HOST}" pattern="^basetst\.tampagov\.net$" />
                                 </conditions>
                                 <serverVariables />
                                 <action type="Redirect" url="http://basetst.tampagov.net/Basetst" />
                            </rule>
                     </rules>
                </rewrite>
       </system.webServer>
    </location>

 

Any assistance is greatly appreciated.

How to create a redirect through the "RewriteEngine On"

Create redirection - Microsoft URL Rewrite

Rewrite a portion of the URL only and save settings

$
0
0
<div>Hello</div>

<div>(Sorry:I'm abeginner)</div>

<div>Iwant torewriteaportionofthe URL.Forexample:</div> <div>myexe? tabid = 2 &amp; subtabid = 29</div>

<div>myexe.exe? tabid = 2 &amp; subtabid = 29</div>

<div>I confessthatIdidnotunderstandeverythinginthemapofrewritingchapter</div> <div>Somethingescaped me...butwhat?</div>

<div>Thanksforyourhelp</div> <div>VictorAB</div>
Viewing all 2482 articles
Browse latest View live


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