MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

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

Viewed 10647 time(s), 7 post(s) 2/18/2013 10:47:50 AMby deska5
deska5

deska5

2/18/2013 10:47:50 AM
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.
This content has not been rated yet. 
56 Reputation 7 Total posts
khorvat

khorvat

2/18/2013 1:07:04 PM
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
This content has not been rated yet. 
15993 Reputation 2214 Total posts
deska5

deska5

2/18/2013 1:21:51 PM
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.
This content has not been rated yet. 
56 Reputation 7 Total posts
khorvat

khorvat

2/18/2013 2:00:52 PM
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
This content has not been rated yet. 
15993 Reputation 2214 Total posts
deska5

deska5

2/18/2013 2:44:58 PM
because i have indexed in google a lot off old addresess and i need redirect old addresses to new with auto 301 automatically.
This content has not been rated yet. 
56 Reputation 7 Total posts
khorvat

khorvat

2/18/2013 3:20:55 PM
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 
This content has not been rated yet. 
15993 Reputation 2214 Total posts
deska5

deska5

2/18/2013 3:33:38 PM
Thanks
This content has not been rated yet. 
56 Reputation 7 Total posts