Hey there my redicret is not working and i don't understand why.
My rule looks like this :
<rewrite>
<rules>
<rule name="rewrite to article" stopProcessing="false">
<match url="^showfirm.asp\?rubrik=([_0-9a-z-]+)" />
<action type="Redirect" url="esbjerg/sog/?q={R:1}&t=" redirectType="Temporary" />
</rule>
</rules>
</rewrite>
When i try to match the url with
http://localhost/showfirm.asp?rubrik=sometexthere
I hit my custom 404 page, instead of hitting
http://localhost/esbjerg/sog/?q=sometexthere&t=
Anyone who can help ? Im using an IIS 7.5 with urlrewriter 2.0
Ps : First time doing an url redirect :)
Try this:
<match url="^showfirm\.asp\?rubrik=([_0-9a-z-]+)" />
Related
We have recently started using MVC which has modified the way we browser to our site in IIS.
We currently have a website address like this:
http://myserver.mydomain:123/
What we need is to redirect to this site:
http://myserver.mydomain:123/web
This needs to work for all pages in our site (i.e /web/login.aspx /web/workflow.aspx etc.)
This is what I have currently setup our configuration in our web.config file:
<rewrite>
<rules>
<rule name="Root Hit Redirect" stopProcessing="true">
<match url=".*123" />
<action type="Redirect" url="/web" />
</rule>
</rules>
</rewrite>
This does not work for all occurrences.. Please help
I even tried this and still no luck..
<system.webServer>
<rewrite>
<rules>
<rule name="test">
<match url="^https://localhost:3443/$" />
<action type="Redirect" url="web/login.aspx?ReturnUrl=%2fweb" redirectType="Found" />
</rule>
</rules>
</rewrite>
</system.webServer>
I have been trying to creat an IIS Rewrite rule that looks at the incoming Header for an API and if it contains a certain string re-direct them to a certain page and not the API (Noobs - Using documentation API Keys)
Been at it 2 hours and just can't work it out. Could anyone help?
Thanks
Finally Got it! Here is teh rule below for anyone else that is interested.
<rewrite>
<rules>
<rule name="Rewrite Noob Documentation API Key" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_Authorization}" pattern="^ukvd-ipwhitelist ABCD1234-1b3d-4d63-aa75-ABCDEF123456$" />
</conditions>
<action type="Redirect" url="https://xxx.co.uk/dockey.html" appendQueryString="false" />
</rule>
</rules>
</rewrite>
Is it possible to remove a directory from a URL without using a redirect action? In other words can I do it with only a "rewrite" action.
I need to take a URL like this: http://www.example.com/de/folderabc/specs/default.aspx and remove the "folderabc" directory to make it like this: http://www.example.com/de/specs/default.aspx
So far any variation I have tried like this is not working:
<system.webServer>
<rewrite>
<rules>
<rule name="removefolder" stopProcessing="true">
<match url="folderabc/(.*)" />
<action type="Rewrite" url="/{R:0}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
I am using IIS 7.5.
Try putting a caret ^ in your url to match on.
<match url="^folderabc/(.*)" />
I'm trying to set the canonical URL for my site (macton.com) to add the www in the beginning. The site is hosted using IIS and I installed the URL Rewriter Extension.
Here is the code I put in the web.config file. However, it doesn't seem to do anything, because it remains macton.com.
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to www" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^macton\.com$" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="http://www.macton.com/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
After this I have a bunch of <location> tags with redirects that work fine. I tried using a redirect from macton.com → www.macton.com but that just creates an infinite redirect loop (DUH!)
Any idea why this wouldn't be working? Everywhere I look says this is the correct code!
This link can help:
http://www.awseibert.net/how-to/redirecting-canonical-names-in-iis-7
Have you also added macton.com to the binding of your website?
I want to redirect an old directory to the new one (301 redirection). In my case i want this :
http://www.mydomain.com/xxxx/ redirect to http://www.mydomain.com/yyyy/
http://www.mydomain.com/xxxx/1-my-product-name redirect to http://www.mydomain.com/yyyy/1-my-product-name
http://www.mydomain.com/xxxx/c/my-category-name redirect to http://www.mydomain.com/yyyy/c/my-category-name
etc...
To do this, I use the URL Rewriting module on IIS to do this. This is my rule in my web.config :
<rule name="test" stopProcessing="true">
<match url="xxxx" />
<action type="Redirect" url="yyyy{R:0}" appendQueryString="true" />
</rule>
It works fine with http://www.mydomain.com/xxxx/1-my-product-name and http://www.mydomain.com/xxxx/c/my-category-name but when i go to http://www.mydomain.com/xxxx/ it's redirect to http://www.mydomain.com/yyyy// with two slahes. Anyone know how to avoid this ?
Thanks in advance !
I found, this is the rule that i used :
<rule name="tpepme" stopProcessing="true">
<match url="xxxx(.*)" />
<action type="Redirect" url="yyyy{R:1}" appendQueryString="true" />
</rule>