having a bit of trouble here, I'm working on a web.config file to perform a URL redirect from a file to a folder. I have the following:
<rule name="redirect fleet/cats.asp" stopProcessing="true">
<match url="^fleet/cats.asp$" ignoreCase="false" />
<action type="Redirect" redirectType="Permanent" url="http://www.ccy.com.au/availability/{R:1}" />
</rule>
Which redirects:
/fleet/cats.asp to /availability/cats.asp
What I want to achieve is:
/fleet.cats.asp to /availability/
What am I missing to achieve this? Any help would be greatly appreciated, thank you in advance!
I found that I had to remove {R:1} on the action attribute. that way I can redirect from a page to a directory. Thanks me!
Related
I've implemented Friendly URLs in a Webform project but it allows a user to go to either the root of the website or /default. I really want to get rid of the /default option by having it always just route to the root. I've tried using
routes.MapPageRoute("", "Default", "~/")
but that doesn't seem to effect anything.
Anyone now the proper way to accomplish this?
The easiest way to achieve this will be through IIS not in code. It will create a 301 redirect from requests to default.aspx to the root.
<system.webServer>
<rewrite>
<rules>
<rule name="default page" stopProcessing="true">
<match url="^default\.aspx$" />
<action type="Redirect" url="{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
I've moved my blog to a different domain, and am trying to set up some redirect rules to redirect traffic. I have added the following to the system.webServer section of my web.config...
<rewrite>
<rules>
<rule name="URL1" stopProcessing="true">
<match url="oldurl.aspx" ignoreCase="true" />
<action type="Redirect" url="http://newdomain.com/newurl" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
...but it doesn't redirect.
I've tried using URLs of the following forms in the url attribute of the <action> tag, but it doesn't make any difference...
^/oldurl.aspx
/oldurl.aspx
http://olddomain.com/oldurl.aspx
Anyone any ideas what I'm doing wrong? As far as I can see, I've done the same as all the blog posts and SO answers suggest.
Not sure if it's relevant, but the old blog used dasBlog.
Need some help specifying rewrite rule for:
http://example.com/page/my-unique-title
to
http://example.com/page?id=my-unique-title
Note it is web forms app and I am using friendlyurls. Any help much appreciated.
Try this:
<rule name="myrule" stopProcessing="true">
<match url="page/(.*)" />
<action type="Rewrite" url="page?id={R:1}" />
</rule>
I'm currently researching how to implement URL Rewriting and was wondering if someone could help shed some light.
Our current url structure is the following..
http://example.com/products.cfm?id=1234
http://example.com/recipes.cfm?id=6789
I would like to configure IIS so that URLs can be rewritten to the following (or similar)
http://example.com/products/1234/product-title-here
http://example.com/recipes/6789/yummy-recipe-ever
How would I go about doing this?
Read through this walk through. The example comes close to what you want (replaced aspx with cfm).
<rewrite>
<rules>
<rule name="Rewrite to article.aspx">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="article.cfm?id={R:1}&title={R:2}" />
</rule>
</rules>
</rewrite>
Look into Coldbox there is a rewrite.ini and IS7 web.config included
http://wiki.coldbox.org/wiki/URLMappings.cfm
The Coldbox blog shared this link
http://blog.coldbox.org/blog/coldbox-and-url-rewrites-with-iis-7
I am redirecting a lot of old pages because of a new webdesign. However I have run into one little issue.
I want to redirect:
www.domainname.com/Default.aspx
But not redirect
www.domainname.com/somesub/Default.aspx
I need it written like this:
<rule name="301 Redirect Default">
<match url="???????" />
<action type="Redirect" url="http://www.domainname.com/index.php" redirectType="Permanent" />
</rule>
Where the questionmarks mark the regex I need.
Can anyone help?
Cheers
How about
<match url="^Default\.aspx" />
Also see e.g. this article regarding IIS rewrite rules.