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 )

12357 put(a) pogledan, 7 odgovor(a) 18.2.2013. 10:47:50Kreirao(la) deska5
deska5

deska5

18.2.2013. 10:47:50
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.
Ovaj sadržaj još nije ocijenjen. 
56 Reputacija 7 Ukupno objava
khorvat

khorvat

18.2.2013. 13:07:04
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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
deska5

deska5

18.2.2013. 13:21:51
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.
Ovaj sadržaj još nije ocijenjen. 
56 Reputacija 7 Ukupno objava
khorvat

khorvat

18.2.2013. 14:00:52
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
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
deska5

deska5

18.2.2013. 14:44:58
because i have indexed in google a lot off old addresess and i need redirect old addresses to new with auto 301 automatically.
Ovaj sadržaj još nije ocijenjen. 
56 Reputacija 7 Ukupno objava
khorvat

khorvat

18.2.2013. 15:20:55
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 
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
deska5

deska5

18.2.2013. 15:33:38
Thanks
Ovaj sadržaj još nije ocijenjen. 
56 Reputacija 7 Ukupno objava