404 handling, forum url rewrite

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
12/12/2008 4:41:27 AM
Nux
Gravatar
Total Posts 183

404 handling, forum url rewrite

Hey Joe,

2 question.

First, I'm having some problems with the 404 handling.

I have removed the custom error tags from the web.config, since this is only good for the user and not for search engines.
But now I don't have a correct 404 handling (Yes, I have set the 404 in IIS to a correct file).
So i wonder if it's not possible to add more handling of this in the code of Mojoportal?
There was a suggestion, but that lost it's focus since it went to logging. I haven't tested this, but would it be possible to make a 404 aspx page, which is customisable like other pages, but returns a 404 status? Just an idea. I'm thinking now to setup IIS that it handles everything with asp isapi and make a httpmodule for it.

Second question: would it be a lot of work, to make a forum with SEO friendly url's?
Something like /forums/date/title-of-the-topic.aspx. Difficult?

Stef

12/12/2008 6:38:14 AM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

Hi Stef,

Nothing stops you from creating a custom aspx page with inline code (no code behind file) and drop it in as your custom error page.

Keep in mind that it safer to use a plain html page for the error page, otherwise its possible your error page will itself throw errors.

In either case you should put the customErrors section back.

<customErrors mode="RemoteOnly" defaultRedirect="yourcustomerrorpage.aspx">
<error statusCode="404" redirect="~/PageNotFound.aspx" />
</customErrors>

If you want to use the defauolt IIS 404 page then remove this part:

<error statusCode="404" redirect="~/PageNotFound.aspx" />

I think it would be quite a bit of work to get that kind of friendly url in the forums and its not a high priority for me. Also I find google indexes my forums just fine. Can you point to any forums online that have this kind of url as you suggest? One of the problems is it still requires query string params for things like page number if the thread has more than one page. Another consideration is do I really want untrusted users to be able to create expressive urls in my site. I'm not sure its desireable to have urls like that in the forums. I've seen url schemes in forums that are perhaps more seo friendly than what we have now but not ones where the topic is expressed in the url.

In any case I think there are more important things to work on.

Best,

Joe

12/12/2008 7:06:55 AM
Nux
Gravatar
Total Posts 183

Re: 404 handling, forum url rewrite

Joe,

It's not the error page I'm talking about, but the 404 page.

Have you ever checked the status code of those <error statusCode="404" redirect="~/PageNotFound.aspx" /> page?
That is just a redirect and that gives a 200 code. So no 404 like google wants. I had troubles with webmasters tools, since there is no good 404 handling. And no, I don't want the webmasters tools verification meta tag in my html.
 

About the forum: if you think that the google index is just fine, ok for me than. I understand that there are more important things to work on.
Just to give you an online forum: http://forum.yetanotherforum.net/yaf_postst7342_Could-I-modify-the-font-size-in-the-Forum.aspx

Stef

12/12/2008 7:13:13 AM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

Perhaps you are right, maybe I should remove the

<error statusCode="404" redirect="~/PageNotFound.aspx" />

or maybe I should put code in that PageNotFound.aspx page to set the status to 404, perhaps that would be better?

What do you think would be better?

Joe

12/12/2008 7:30:14 AM
Nux
Gravatar
Total Posts 183

Re: 404 handling, forum url rewrite

The problem with that way of working, is that the url changes with a wrong page.
The url stays the same if you configure IIS correct. So I wouldn't give the pagenotfound.aspx a 404 status. It will always be that pages that gives a 404.

What to do best?

I have changed the IIS settings and putted a 404.html in the setting. That way, when I go f.i. to www.mysite.com/sdqfsdf, I get that 404.html.
If you go to www.mysite.com/sdqdsf.aspx, you get the asp.net error page:

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /sdfsdf.aspx

So I wonder if you do that in debug mode, that the cursor is coming the code of the default.aspx (I guess everything of the normal things of the cms, so not the form, blog, ... is parsed via the default.aspx). If it comes in the page, you can check if that url is in the db (301 of normal db) and if not, you can say that the page is the 404 page (page with a fixed id in the db so we can also put modules on it) and render it and give it a 404 status code.

I'm doing things like that in our applications. But that will only work if you you can come in the default.aspx

Stef

12/12/2008 7:39:05 AM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

I will investigate a solution for this that doesn't require custom configuration of IIS. I think we can trap 404 errors in a handler and set the response without changing the url, and perhaps integrate the google 404 enhancement script.

Best,

Joe

12/12/2008 7:40:31 AM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

Heres a better link about the google 404 enhancement script.

12/12/2008 8:09:34 AM
Nux
Gravatar
Total Posts 183

Re: 404 handling, forum url rewrite

Ok, cool.

Must say that if you can do it in the default.aspx, you don't have to configure something in IIS.
I think that every page is captured with this. The only thing that will not work, is if you go to www.mysite.com/somethingthatdoesnotexist

One thing: please do not put that 404 widget standard in the 404 page. Make a module for this, so people can choose if they want that.

Stef

12/12/2008 12:13:14 PM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

Ok, I implemented better 404 handling (at least for .aspx and files handled by .NET).

I've updated this site with the new code. So for example if someone typos the url to the download page like this

http://www.mojoportal.com/dwnload.aspx

It will go to the 404 and google will suggest the correct download url

If you use Firebug you can see the status is 404.

I have some other things to finish before I can merge this to trunk. Currently its in my sandbox and it will only compile at the moment for MySql because I haven't implemented some new web store methods in MS SQL yet. Should have it in ther by tomorrow night though.

This was a good suggestion, the previous handling of 404s was masking 404s from google for .aspx pages.

Its possible to disable the handler by commenting out the httpmodule in Web.config

<add name="PageNotFoundHandler" type="mojoPortal.Web.PageNotFoundHttpModule, mojoPortal.Web" />

and you can disable the google enhancement by setting this to false in user.config

<add key="EnableGoogle404Enhancement" value="true" />

Its also possible to render a custom 404 page using this setting:

<add key="Custom404Page" value="/PageNotFound.aspx" />

you can put a different .aspx page or even a plain html page.

The built in PageNotFound.aspx is nice because it shows the skin and menu. Seems a pretty good solution.

Best,

Joe

 

 

 

12/14/2008 2:50:54 PM
Nux
Gravatar
Total Posts 183

Re: 404 handling, forum url rewrite

Looking forward to the next release.

Thanks
Stef

12/15/2008 7:19:50 AM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

The 2.2.8.0 release is now available.

Best,

Joe

7/10/2009 2:00:18 PM
Nux
Gravatar
Total Posts 183

Re: 404 handling, forum url rewrite

Hi Joe,

long time we spoke about this item, but I have a new question: is there a reason why the user gets the site in "non logged in" mode, and not in the mode the user is in on the pagenotfound.aspx? This is confusing for the user I guess. One time you are logged in, suddenly, you are not (while the user is still logged in) and you see a lot less because of the not logged in mode if you have pages for certain members.

I guess there is a reason, but I would like to hear it .

Stef

7/11/2009 8:35:11 AM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

Hi Stef,

I see what you mean, I had not noticed it. So basically what happens is to have a friendly 404 we can't redirect to a a page, because we still want the response code to be 404 and we don't want a different url. So what we do is make a server side web request to get the contents of the PageNotFound.aspx page and we render it into the reponse and set the 404 status code. So this server side request is not made by the user so its not an authenticated request.

I think the best solution I can come up with is for me to add some code into the PageNotFound.aspx that will hide the login and register links completely on that page.

Best,

Joe

7/13/2009 5:55:29 AM
Nux
Gravatar
Total Posts 183

Re: 404 handling, forum url rewrite

Hey Joe,

that server request, is it a server.transfer? Or something else? Cause, I can not find it now, but I thought you could do a request on the server with the correct user. I have to search for it. It is also strange that when you go to the pagenotfound.aspx, you get the correct menu/layout. It is just when this page is rendered when you have the wrong page, that it's not correct.

Never heard of what I'm talking about, authenticated server side request?
Cause if you can avoid hiding links, I would do that. I hate it when suddenly things are hidden. But that is just me .

Stef

7/13/2009 7:50:07 AM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

Hi Stef,

Its a server side web request to retrieve the content of the custom 404, there is no server.transfer nor response.redirect involved. I certainly am not aware of an easy way to impersonate the user because its based on cookies so the server side request we make is not going to have the user's authentication cookies.

Generally I think the perception problems you are talking about are because our custom 404 looks too much like a normal page, many sites solve this by having minimal content and links on the page to make it more clear that its an error page (albeit a friendly one) and I think this would clear up any ambiguity of perception probably better than trying to adapt it so it keeps the user context. Whereas right now the page looks so normal that it is perceived like any normal page rather than as an error page.

When I look at these examples of custom 404 pages I only see a few where they show a menu at all, most of them go for a very clean friendly error page without menus or other things that make it seem like a normal page in the site

I generally prefer simple solutions to complex ones. I can easily make the error page not select/highlight a page in the menu and I can easily remove things that lead to confusion but I do not want to add a lot of complexity to make it seem like no error has happened. A 404 is an error and perhaps the issue is that we've gone too far in making it look like a normal page, but since its not quite all the way normal its more confusing.

Its currently possible to use a custom 404 other than the one we include. The config setting <add key="Custom404Page" value="/PageNotFound.aspx" /> allows you to define your own custom 404 page.

Best,

Joe

7/13/2009 1:37:10 PM
Nux
Gravatar
Total Posts 183

Re: 404 handling, forum url rewrite

Generally I think the perception problems you are talking about are because our custom 404 looks too much like a normal page...

Well, I do like that, but indeed, it must be very clear to the visitor that this is a 404 error page. And to me (and to others, cause I saw some one going to my site and linking to a wrong page and it was clear to him) this is a good solution, specially with the option to use the google tool. And you still have the opportunity to create your own custom 404 page.

I generally prefer simple solutions to complex ones. I can easily make the error page not select/highlight a page in the menu and I can easily remove things that lead to confusion but I do not want to add a lot of complexity to make it seem like no error has happened.

Joe, what I suggest:

  • hide the menu
  • create a link on the word "Site map" in the text that becomes visible (We're sorry but we could not find the page you are looking for. Please try the Site Map)
  • and optional: hide the link(s) you were talking about (sign in, ...)

I guess that is visually better and not that much work, not?
Again, that is my suggestion and I guess this situation (authenticated vs non authenticated menu) is more an exception than the rule.

So it's up to you .

Stef

 

7/13/2009 2:11:01 PM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

Yes, these suggestions are exactly the happy medium easy to implement kind of solution I was thinking of, I will do these things.

Best,

Joe 

7/13/2009 2:23:11 PM
Nux
Gravatar
Total Posts 183

Re: 404 handling, forum url rewrite

Thanks Joe

11/19/2009 12:01:19 PM
Gravatar
Total Posts 221

Re: 404 handling, forum url rewrite

Hate to bring up an old post, but my question is pretty relevant to this thread:

I have a different opinion on this along with some clients who would like it if the main navigation does appear on the 404 page. The thinking is that if a user is on a 404 page they can easily choose from the main nav to go somewhere else. I think the red message is clear enough (for me anyway).

Is there a setting somewhere that can be changed to show the main nav on the 404 error page? Personally I'd like the masterpage to display the same on a regular page as it does on the 404 page. The logged in issue isn't that important, I'm mostly considering usibility for the end user when they land on that 404 page. I want them to choose elsewhere to go in my site and not hit the back button to go back to a Google search result list for example.

Thanks!!

11/19/2009 12:11:47 PM
Gravatar
Total Posts 18439

Re: 404 handling, forum url rewrite

Hi Eric,

You can disable the google help and it is possible to use a custom 404 other than the one we include so you can do whatever you like with it. 

 

<add key="Custom404Page" value="/PageNotFound.aspx" />
    <add key="EnableGoogle404Enhancement" value="true" />

<add key="Custom404Page" value="/PageNotFound.aspx" />    
<add key="EnableGoogle404Enhancement" value="true" />

I will add an additional setting for the next release:

<add key="SuppressMenuOnBuiltIn404Page" value="true" />

Off course if you use a custom 404 page then the other settings don't apply because I have no control over a custom page.

Best,

Joe

 

 

11/19/2009 12:43:17 PM
Gravatar
Total Posts 221

Re: 404 handling, forum url rewrite

Perfect, this would be excellent!
<add key="SuppressMenuOnBuiltIn404Page" value="true" />

This CMS is awesome, I tell everyone about it and how fluid and on top of things the developer of it is!

11/25/2009 5:51:57 PM
Gravatar
Total Posts 221

Re: 404 handling, forum url rewrite

Just installed the 2.3.3.0 release and this works great, thanks. A few beers coming your way, don't drink too much now!

You must sign in to post in the forums. This thread is closed to new posts.