Improve SEO for custom error pages

Posted by Community Admin on 03-Aug-2018 15:51

Improve SEO for custom error pages

All Replies

Posted by Community Admin on 28-May-2014 00:00

Hey guys, 

I don't know if this is the right section but I would like to ask if anybody knows the answer to this little issue i am experiencing.

so basically when page is not found the sitefinity redirects to a custom Error page (404);  by
using Fiddler, I noticed before landing on the Custom Error Page, the page I requested gets a 302 status.

Having 302 followed by a 404 kind of sucks from an SEO perspective.

I guess my question is, It is possible to make the 302 into 301 instead?

 

Posted by Community Admin on 29-May-2014 00:00

Hello Max,

I could suggest to insert some code in your global.asax file. Something similar to this could do the trick:

protected void Application_Error(object sender, EventArgs e)
    Exception ex = Server.GetLastError();
    if (ex is HttpException)
    
        var context = HttpContext.Current;
        context.Response.Clear();
        context.Response.Status = "301 Moved Permanently";
        context.Response.AddHeader("Location", "customErrorPage");
        context.Response.StatusCode = 301;
        context.Response.End();
    

Hope this helps

Regards,
Vassil Vassilev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 30-May-2014 00:00

Thank you for the reply,

I used the code you provided but I still receiving 302 error then 404

FYI: I have Sitefinity 5.1 i don't know if it helps or not.

 

Posted by Community Admin on 31-May-2014 00:00

Hello Max,

Actually this should not be related with the Sitefinity version you are using. Here is a video of my test, which works as expected.

Regards,
Vassil Vassilev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed