How can I rewrite the URL:
test.xy/Objekte/Haus-in-Rheinstetten
to
test.xy/Objekte/Haus-in.cfm?Ort=Rheinstetten
The part behind the second - in Haus-in-Rheinstetten convert to a url-Parameter
You can use web.config file.
This file located in the folder of your site.
Example of rewriting rule:
<rewrite>
<rules>
<rule name="Rewrite to some page">
<match url="http://some.site/some.page" />
<action type="Redirect" url="http://other.site/other.page" />
</rule>
</rules>
</rewrite>
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 a url:
http://example.com/post.aspx?post=postname
I want redirect it on IIS to :
http://example.com/postname
1.Download UrlRewrite Module 2.0 From Microsoft
2. Install on server.
3.Put Code inner (system.webServer) Section on Web.Config file.
4.Save.
5.Enjoy Now.
<rewrite>
<rules>
<rule name="PostRedirect1">
<match url="^Post/([a-zA-Z0-9]+)" />
<action type="Rewrite" url="post.aspx?post={R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
I want to redirect a url to be be redirected to another url preserving querystring:
I want to redirect this url:
http://my.website.com/utilities/myservice.svc/item?longquerystring
to
http://my.website.com/utilities/myservice.svc/items?longquerystring
I have written the following code in my web.config:
<rewrite>
<rules>
<rule name="Test" patternSyntax="Wildcard" stopProcessing="true">
<match url="http://my.website.com/utilities/myservice.svc/item(.*)" />
<action type="Redirect" url="http://my.website.com/utilities/myservice.svc/items"
appendQueryString="true" />
</rule>
</rules>
</rewrite>
The above code is not working. Can you help me writing the correct rule there?
I'm migrating my blog from LAMP/PHP to IIS. To preserve the URLs, I'm using the URL Rewrite Module. Out of 192 pages, this works on 191. Essentially I need to replace the "index.php" portion of the URL with a directory name and append an ".html" suffix.
My RegEx pattern:
^myblog/index\.php/(.+)
My rewrite URL:
myblog/contents/{R:1}.html
This works in most cases, rewriting
http://www.MYSITE/myblog/index.php/2013/04/29/goto_slides
to
http://www.MYSITE/myblog/contents/2013/04/29/goto_slides.html
However, it fails in one case:
http://www.MYSITE/myblog/index.php/2013/04/29/goto_notes_evolving_java
This returns 404, and the error page says the requested URL is:
http://MYSITE:80/myblog/contents/2013/04/29/goto_notes_evolving_java
(Note that the ".html" suffix was not added; adding that finds the page.)
The only difference I can see between URLs that work and the one that doesn't is the trailing "java".
How can I fix or work around this?
The web.config, per request:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<rewrite>
<rules>
<clear />
<rule name="Rewrite blog URL from old PHP location" stopProcessing="true">
<match url="^myblog/index\.php/(.+)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="myblog/contents/{R:1}.html" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Removing the condition will fix your issue.
Your rule will become:
<rule name="Rewrite blog URL from old PHP location" stopProcessing="true">
<match url="^myblog/index\.php/(.+)" />
<action type="Rewrite" url="myblog/contents/{R:1}.html" appendQueryString="true" />
</rule>
I am trying to setup some rewrite rules for sub folders.
Example
Redirect the following
/somefolder
/somefolder/
to
/somefolder/default.aspx
<rewrite>
<rules>
<rule name="Some Folder">
<match url="^/somefolder$" />
<action type="Rewrite" url="/Somefolder/default.aspx" />
</rule>
</rules>
</rewrite>