Welcome to Idea R | Branding - Web Agency - Digital Stategies
Switch to the mobile layout

      Idea R - Keywords Mixer, the Web Marketing application - Free Download
  • Home
  • About Us
  • Contacts

Blog

Take a software geek from the 80s, add a new generation graphic designer and dilute with a long time marketing strategist. Shake vigorously and you'll get the Idea R's blog.

Change language... italiano

You may be interested in

How to make your website look great on social media

How to make your website look great on social media

Your links on social media have sometimes no featured photo? The description is truncated? Here's a short guide to not leave things to chance.

Lazy loading and the SEO problem, solved!

The best SEO solution to index your dynamically loaded contents, no more compromises!

Last published

How to fix your ASP.NET site to be responsive on Windows Phone

How to fix your ASP.NET site to be responsive on Windows Phone

Internet Explorer 10 for Windows Phone 8 suffers a bug when displaying responsive web sites. See how to fix it server-side with few lines of code.

Mental marketing secret #3: the unconscious buddy

Another mental marketing secret: may be you know that sometime magicians use buddies, but frequently these buddies are not aware of that.

Most popular

Keywords Mixer: download the free web marketing tool

There's a basic implementation inside Google AdWords Editor, but this tool will give you more control over keyword permutations and long tail ones.

Editor's pick

Mental marketing secret #1: the fake compromise

Mental marketing secret #1: the fake compromise

Can mentalism influence marketing? As a marketing professional and a long term magician, I will reveal you some tricks.

How to dramatically increase social media LIKEs to your web site

Here's a free download that I created some time ago. It's a good tool for increasing engagement, but use with caution.
RSS feed

ASP.NET 301 permanent redirects: the best solution

Published on 12/11/2012
ASP.NET 301 permanent redirects: the best solution

Have you changed your domain and don't want to loose your SEO page rankings?
Do you have renamed a page and don't want to return errors to users that have saved a bookmark?
You have to perform a 301 permanent redirect to the new page/site.

There are plenty of methods to perform this, if you Google the question you'll be submerged by the answers.
Curiously the easiest method doesn't come out first.
Let's explore some of the most common methods and then at the end I'll show you the best one.

Redirecting an ASPX page by code

Place the following code in the ASPX page to be redirected:

protected void Page_Load(object sender, EventArgs e)
{
    this.Response.RedirectPermanent("http://www.mynewdomain.com/MyNewFile.aspx");
}

The drawback of this method is that you can redirect only ASPX files, if you have to redirect from an HTML file you cant.

Redirecting an HTML page by client code

You can use the following JavaScript:

<script type="text/javascript">
    window.location = 'http://www.mynewdomain.com/MyNewFile.aspx';
</script>

The drawback is that this is only an hack, you'll redirect the page, but not using a real 301 permanent redirect: your page rank won't be passed from the old page to the new.
You can add the following meta tag, but you'll never get the same result as a real 301 permanent redirect:

<link rel="canonical" href="http://www.mynewdomain.com/MyNewFile.aspx" />

Redirecting an HTML page by server code

You have to create a class that derives from IHttpHandler and intercept all HTML requests.
This is a long and annoying task, especially if not all HTML pages have to be redirected.

Did you like this article up to here?

Before you continue, follow us on our Facebook page pressing the button here below!
In this way, we'll be able to keep you updated on digital strategies not only with our posts, but also with the best of articles that we collect around the web.

 

The best solution: redirecting by configuration

It is not easy to find this solution on Internet, because you'll find tons of samples of the previous ones.
If you have IIS 7 or higher that's the best way to redirect!
Simply use the httpRedirect element of the system.webServer section and you'll be able to redirect everything you want, ASPX, HTML, PHP, etc.

<httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Permanent">
    <add wildcard="/MyOldAspFile.aspx" destination="/MyNewFile.aspx" />
    <add wildcard="/MyOldHtmlFile.html" destination="/MyNewFile.aspx" />
</httpRedirect>

This method is very powerful, for example if you have changed the domain but the pages are the same, you have just to add:

<system.webServer>
    <httpRedirect enabled="true" childOnly="true" destination="http://www.mynewdomain.com/" />
</system.webServer>

You are the visitor number 2643.

Comments

comments powered by Disqus
Creative Commons License

Photographies, videos, graphics and texts by Idea R are licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.

Previous article

Previous article

Anamorphic illusions: all you're going to see is authentically false

Next article

An App to see Amsterdam through Anne Frank's eyes

Next article

Scroll to top

  • Visual Communication, Art Direction
  • Apps, Cloud, Mobile, Software Design
  • Digital Strategies
  • Blog
Touching finger
RSS feed
Blog