Mono Support MonoX rewrite old addresses to new, and add auto 301 from old address to new. 

Viewed 11360 time(s), 7 post(s), 2/18/2013 10:47:50 AM - by deska5
2/18/2013 10:47:50 AM
56 Reputation 7 Total posts

Hello 
I changed url rewrite rules in my webconfig:

from

<rewrite
url="^(.*)/address-1/(.*)/(.*)/(\?(.+))?$"
to="Page.aspx?$action1=$1;action2=$2"
name="some-rule-name"
urlPattern="/address-1/{Value}/{Value2}/"/>
to 

<rewrite
url="^(.*)/address-2/(.*)/(.*)/(\?(.+))?$"
to="Page.aspx?$action1=$1;action2=$2"
name="some-rule-name"
urlPattern="/address-2/{Value}/{Value2}/"/>
and changes are ok, but i need also set 301 redirect from address-1 to address-2,
how can i do it in MonoX?

Thanks.

1
2/18/2013 1:07:04 PM
15993 Reputation 2214 Total posts

Hi,

you should update the custom errors section in web.config as described on MSDN.

<customErrors mode="On" defaultRedirect="/MonoX/Pages/MonoX/Error.aspx">
  <!--<error statusCode="404" redirect="/WebTest/ErrorPages/404.html" />-->
</customErrors>

Regards

2
2/18/2013 1:21:51 PM
56 Reputation 7 Total posts

Thank you for your answer,

This is not what i need - sorry,  maybe i didn't say fairly clairy:
i have in web.config enabled customErrors, so when i write old  address then site show me 404, but i need do 301 on old address and redirect to new. I hope now it is easier to understand.

Thanks.

3
2/18/2013 2:00:52 PM
15993 Reputation 2214 Total posts

Why don't you just add the rule for address-1 and redirect to address-2, if that is possible ? Other than that you will need to point old address to some page and return 301 with the redirect.

Regards

4
2/18/2013 2:44:58 PM
56 Reputation 7 Total posts

because i have indexed in google a lot off old addresess and i need redirect old addresses to new with auto 301 automatically.

5
2/18/2013 3:20:55 PM
15993 Reputation 2214 Total posts

Hi,

MonoX Url rewriting is based on the .NET UrlRewriter and here is an example how to achieve automatic 301 redirect - http://urlrewriter.net/index.php/support/reference/actions/custom-action.You can also check the following built-in action Set Status.

So you can use the combination of if with rewrite and set status to achieve this with the built-in actions.

Regards 

6
2/18/2013 3:33:38 PM
56 Reputation 7 Total posts

Thanks

7
This is a demo site for MonoX. Please visit Mono Software for more info.