iFinity Blogs 

Sep 20

Written by: Bruce Chapman
Thursday, September 20, 2007 10:00 AM 

Redoing the DotNetNuke Friendly Url Provider for Human Reading and Search Engines Indexing

NOTE: Due to popular demand, there is now a Support Forum for support requests on this module, or if you just want the thing to work ASAP, I can provide one-on-one support or install it for you.

What I did previously was improve upon Scott McCulloch's work by working out a way to handle parameters. All well and good, and it worked OK. But it just still didn't look quite right. What's more, I wanted to use the rel="tag" microformat on my tagging module, and I was stuck with the .aspx extension on everything, which the microformat doesn't recognise.

So after some back and forwards on the Ventrian forum where I posted my update, I went away and had a good think about it. There were two things nagging at me:

  • 1. The performance would drop off drastically with the number of pages in a site, due to the iterative search for a match.
  • 2. The only way to get truly nice Url's is to ditch the page extension of .aspx. When you think about it, it doesn't serve the user at all. It's really only there to make it easier on the web server. It had to go

Doing number 1 was easy : just do a dictionary based lookup on the page path, if it's found, great. If not, 404 coming right up.

It works like this (if you're not intimately familiar with DNN, you might want to skip to the next part). On the first request, a dictionary of path information is built up. This contains the path (example: mysite/mypage) and the actual DNN request Url (example: default.aspx?tabid=37). The dictionary is stashed away in the Cache.
So far so good. The incoming url is deconstructed into segments. Working backwards from the full url (mysite/mypage/mypath/myvalue) the url is tried against the dictionary for a 'hit'. If a page entry in the dictionary is found, great, the url is rewritten and processing continues.
If the dictionary didn't contain the page, then the next segment is removed, thus mysite/mypage/mypath/myvalue is trimmed to mysite/mypage/mypath. This trimming process is repeated until there are not segments left. If nothing was found after all that, the page dictionary is rebuilt one more time, just in case it's a new page, then the process is repeated. If still nothing, then no url rewriting will be done and a 404 will probably occur.

There is obviously a great deal more complexity in it than that, but that's the basic algorithm.

So onto number 2. Some will look at you with fear in their eyes when you mention removing the .aspx extension from asp.net pages and declare that 'you cannot change the laws of physics'. But in reality there is nothing difficult about removing the .aspx extension from asp.net pages. There's really two (easy) ways.

  • -> Implement an ISAPI Rewriting DLL. There's some commercial ones available, and some open-source ones. I assume these work OK, but looked like way too much work for me.
  • -> Direct all calls to the website through asp.net by mapping a wildcard (*) to the aspnet_isapi.dll

Given I was already rewriting Urls, the second of those options was the path of least resistance for me. Now I realise that people using DotNetNuke on a shared host aren't going to be able to do this, but if you've got your own server, it's not difficult. By mapping all requests to go through asp.net, all requests for items on the website (or virtual directory) end up going through the DNN Url Rewriter. Eek - better make sure they work then.

To fix this, I implemented a couple of regex filters to be placed in the web.config. These restrict what items will be passed along to IIS unfettered and what will be rewritten by the UrlRewrite code. And that was about it - because the way the dictionary lookup works, the .aspx is redundant anyway. Because all entries in the dictionary are without .aspx, it's not needed to find them again - only the relative path.

Once the messy .aspx extensions are eradicated, getting nicer Url's is easy-peasy. Instead of doing by front-to-back flipping of parameters around, now I just put them out in-line, as they should. So, from the example given in the first posting on this topic, the results now are:

  • Original,standard, DotNetNuke friendly Url: /MyPage/TabId/38/Key1/Value1/Key2/Value/default.aspx
  • My rewritten Url (first version): /MyPage/Value1/Key2/Value2/Key1.aspx
  • My rewritten Url (no .aspx version): /MyPage/Key1/Value1/Key2/Value2

Of course, there are still times when the first-parm-last scenario might work well, so I've left it in as a configurable option. This is particularly the case if you can't remove the .aspx extensions (shared hosting, for example)

Here's the original examples from the first post redone:

  • Directory Module
    • Original: http://www.auctionlink.com.au/Auctioneers/TabId/54/Auctioneer/Grays_NSW/default.aspx
    • First version: http://www.auctionlink.com.au/Auctioneers/Grays_NSW/Auctioneer.aspx
    • New Version: http://www.auctionlink.com.au/Auctioneers/Auctioneer/Grays_NSW/
  • Tagging Module
  • Tagging Module with 2 parameters (tag name and page number)

What about the 301 Redirects?

The 301 redirect code in the original version was an important step forwards for my SEO DotNetNuke efforts. DNN has a habit of outputting a variety of Url's for the same bit of content, so it's important to stay on top of this by both generating a single Url per bit of content, but also to let Google know you've been on the case of hunting down every last default.aspx?tabid=37 and home/tabid/37/default.aspx reference.

So the new code maintains the previous features, and adds a couple more - when a request comes in that doesn't end in a '/', it puts one on. If a request comes in for a page with .aspx, and you've turned .aspx off, then it returns a 301 status and gives the new, cleaner url. As well as this, if you've got a page you've deleted from your website, or it was only visible for a period of time, then requests for the no-longer-valid page will redirect to the home page of your portal with a 301.

Full feature list of this Url Rewriter / Friendly Url Provider

Here's a list of all the things that this version can do:

  • Url's are generated as friendly Urls by all code which uses the standard NavigateUrl() call in DotNetNuke.
  • Choice of page extension - .aspx or any other extension (such as .page)
  • Choice of using page extensions - options are "always", "never", "pageOnly". Always and never are self-explanatory, pageonly means only use an extension when the Url is for a page that contains no query parameters.
  • 301 redirects for 'unfriendly' page requests. This can be on or off.
  • 301 redirects to home page for deleted and expired pages
  • A regex filter can be implemented to restrict 301 redirects for matching Urls
  • Individual pages can be restricted from 301 redirects by placing in a delimited list
  • Choice of two ways of handling parameters/query strings - ordered, in which the values are shown as consecutive levels in a path (key1/value1/key2/value2) and "firstparmlast" in which the first key value is placed last (value1/key2/value2/key2).
  • Choice of detecting duplicate portal alias/page path combinations. It is possible to have portal1/test as a page, and a portal which has portal1/test as an alias, thus duplicating the same path on a single DNN install.

How to install the DNN Friendly Url Provider

Step 1: Download the code from the Free Downloads page.

Step 2: Backup your existing DotNetNuke.HttpModules.UrlRewrite.dll from your website/bin directory, and copy the new version in to the /bin directory.

Step 3: Backup your existing web.config, and then replace the existing 'DNNFriendlyUrl' provider section with this one:

<add name="DNNFriendlyUrl" type="DotNetNuke.Services.Url.FriendlyUrl.DNNFriendlyUrlProvider, DotNetNuke.HttpModules.UrlRewrite" includePageName="true" regexMatch="[^\+a-zA-Z0-9 _-]" urlFormat="HumanFriendly" redirectUnfriendly="true" doNotRewriteRegex="(\.axd)|(/DesktopModules/)" doNotRedirect="DirectorySearchResults;" doNotRedirectRegex="[.]*(/logoff.aspx)" pageExtensionUsage="never" parameterHandling="ordered" ignoreFileTypesRegex="(\.gif)|(\.css)|(\.js)|(\.jpg)|(\.html)|(\.htm)" checkForDupUrls="true"/>

Step 4: Change any options to suit how you'd like your DNN installation to work. The full list is below.

Step 5: Try it out!

If you haven't already done so, you might want to take a look at the DotNetNuke Google Sitemap Generator available in the free downloads section

Changing Config Entries for Different Options

pageExtensionUsage=“never”*

pageExtensionUsage=“always”

/Enquiries/

/Enquiries.aspx

pageExtensionUsage=“never” *

parameterHandling=“ordered”

pageExtensionUsage=“always”

parameterHandling=“ordered”

/TagList/Tag/Valuers/

/TagList/Tag/Valuers.aspx

pageExtensionUsage=“never” *

parameterHandling=“firstparmlast”

pageExtensionUsage=“always”

parameterHandling=“firstparmlast”

/TagList/Valuers/Tag/

/TagList/Valuers/Tag.aspx

pageExtensionUsage=“pageonly” *

pageExtensionUsage=“always”

pageExtension=“.page” **

/Enquiries.aspx

/Enquiries.page

pageExtensionUsage=“pageonly”

parameterHandling=“ordered”

pageExtensionUsage=“always”

pageExtension=“.page” **

parameterHandling=“ordered”

/TagList/Tag/Valuers/

/TagList/Tag/Valuers.page

pageExtensionUsage=“pageonly” *

parameterHandling=“firstparmlast”

pageExtensionUsage=“always”

pageExtension=“.page” **

parameterHandling=“firstparmlast”

/TagList/Valuers/Tag/

/TagList/Valuers/Tag.page



Complete list of web.config options

  • urlFormat (HumanFriendly,omitted) - 'humanFriendly' when using tabid less paths. If omitted, will use standard DNN-style friendly Urls
  • doNotRewriteRegex - regex string for excluding incoming requests. If the incoming request matches the regex, no rewriting will be attempted. This is used to handle exceptions, such as direct calls to pages/controls in the DesktopModules path.
  • checkForDupURls (true/false) - true means an exception will be logged if duplicate urls are found while building the tab dictionary. Duplicate url's are urls where the combination of portalAlias/tabpath from two different portals match. Preference is always given to the 'first' portal / tab path combo, so the second and suqsequent combos will never resolve properly.
  • redirectUnfriendly (true/false) - whether to issue 301 redirect status codes if an incoming url does not match the friendly url for that page
  • doNotRedirect - semicolon delimited list of tab paths where a 301 redirect should never be issued. Use when a particular page should use ?key=val type parameters, or unwanted results are occuring. This is only used when redirectUnfriendly = true
  • doNotRedirectRegex - a regex expression which, when evaluated against the incoming url, will not redirect if the result is a match. In the example, the /logoff.aspx page will never 301 redirect. This is only used when redirectUnfriendly = true
  • parameterHandling (ordered, firstlast) - ordered means key/value pairs are kept in order, and placed after the tab path. ie mypage/mykey1/myvalue1/mykey2/myvalue2. firstlast means take the key of the first parameter and place it last, at the end of the string. mypage/myvalue1/mykey2/myvalue2/mykey1. Default : firstlast
  • pageExtensionUsage (never, pageonly or always) - three options on whether to use page extensions (ie .aspx) for the pages. never = don't use page extensions, pageonly = only use page extensions when the page path does not include parameter key/value pairs (ie mysite/mypage.aspx but not mysite/mypage/mykey/myvalue), always = .aspx is appended to all urls. Default : alwaysUse. If using pageonly or never, the iis setup must have wildcard mapping to the aspnet_isapi.dll (instructions below)
  • ignoreFileTypeRegex (Regex string) - when mapping wildcard requests to aspnet_isapi.dll, the asp.net url rewriting function will be called for all types of iis resources on the page. This means unnecessary file handling for jpeg, gif, css,axd and other file types. By entering a regex string, any match found will bypass the url rewriting code and be passed back to iis.
  • pageExtension - allows the use of a page extension other than .aspx if required. (ie .page, .content - whatever)

Changing IIS Settings for either a custom page extension, or no page extension

Warning: This may destabilise your website. Always check this on a test version first, and understand what you are doing!

These instructions will vary between IIS 5.0, IIS 6.0 and the Workstation and Server versions of 2000/XP/2003/Vista

Changing IIS Settings to map all requests through the aspnet isapi dll

  • open property page for website / virtual directory.
  • click the 'configuration' button, select the 'mappings' tab
  • click on the 'add' button
  • Enter the details:
    • Executable = \framework\\aspnet_isapi.dll
    • For no page extension -> Extension = .*
    • For custom page extension -> Extension = .{your value}
    • Verbs = GET,POST,HEAD,DEBUG
    • Script Engine :checked
    • Check that file exists : unchecked
  • Click OK, OK, OK to close and apply changes.

Then thoroughly test all website functions. And you're done!

Update (22 Nov 2007)

Due to the problems with the 4.7 release and namespace collision with the config part of the module, I've released a new version which uses it's own namespace and should solve the problems. However, this requires new web.config entries. The changes are available in the free downloads section.

This new version requires different modifications to the web.config from those shown in this blog post. The options are the same, but the namespace has changed. Please see the example.web.config file included in the downloads to see what changes are required for the web.config

There are also three new features in this new version, which are set using the following configuration attributes:

  • redirectWrongCase - allows 301 redirection of mixed case requests to lower case requests
  • forceLowerCase - when true, forces all generated Urls to be in all lower case
  • redirectToSubDomain - when implemented, all requests will be 301 redirected to the specified subdomain, regardless of what subdomain they were requested on. Can be left as an empty string to remove the subdomain completely.

Again, see the example.web.config on the different options for these features

Any problems please report them using the comments section below (I might have to stretch to forums one day!)

Update (10 Jan 2008)

In response to the many requests to include a way of substituting spaces with a '-' or '_', I have included a 'replaceSpaceWith' option. This will replace any spaces in a tab path with the supplied character. It will also issue a 301 redirect for any request to the 'space removed' version. This means that existing pages found in search engines will redirect to the new version.

I've also fixed (finally) the problems with getting an exception on the Host Settings page. Basically, in versions of DotNetNuke prior to 4.5, the Friendly Url Provider shared a namespace with internal classes. I've explictly implemented a cast so that my provider will be able to interact with the host settings page. However, for DNN versions 4.6 and above, the FriendlyUrl provider was moved into the single DotNetNuke.HttpModules assembly. This solved the problem, so the later version of my Friendly Url provider just doesn't include the section for reading the FriendlyUrl rules.

The new files can be found on the Free Downloads page. You must install the correct version for your DNN install. If you are running 4.0 - 4.5, then you want the 4.5 version. If you are running 4.6 or later, then you want the 4.6 version. Trying to run the later version with the earlier DNN installs will just cause errors - there is no benefit in running the 4.6 code - it's just a compatibility change, both version are built from the same base source.

Tags:

81 comment(s) so far...

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Sounds good! Initially, everything except the home page was delivering my custom 404 page (which I could never get to work before!), until I realized that the page extension was missing from the url (I thought that the default was "always").

By Dan on   Thursday, September 20, 2007 11:43 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Bruce, I always liked Australians but I really have to raise a V Bitter to you on this one. Weeks of attempts to kill my .ASPX's and TabID's have come to an end! (pretty much)

By Zymmetrical on   Friday, September 21, 2007 2:30 AM

301?

How should users expect the "redirectUnfriendly to behave? If you wouldn't mind, could you explain?

By Dan on   Friday, September 21, 2007 1:51 PM

301 Operation

@Dan

I'll make sure the defaults are correct in the next release.

The redirect works like this : the url rewriter knows what the request Url is. It works out what tab that request is for, and requests the friendlyUrl for that tab is. If the two are different, it issues a 301 redirect for the request, and supplies the friendly Url as the new location.

For an example - if you request www.mysite.com/Home/tabid/37/default.aspx, the friendly url provider will return the friendly url as www.mysite.com/Home.aspx (depending on settings). The two are different, so a 301 redirect is issued so the browser redirects to wwww.mysite.com/Home.aspx

Of course, there are some exceptions, and that's what the regex filters of doNotRedirect (tab path) and doNotRedirectRegex (regex match) are for - anything matching either of these will not be 301 redirected.

In terms of Google, well the googlebot is just a text browser, so if it requests a Url which is in unfriendly format, it will receive the 301 response and index the page at the new location. Presumably after a while the index is updated and gradually your old Url's will dissapear.

Hope that clears it up for you

By Bruce on   Friday, September 21, 2007 2:34 PM

That's the ticket!

For some reason, initially, it was not working that way for me, perhaps a function of a cache, or what have you.
Now, it is working perfectly!

This is absolutely terrific. Kudos and thanks!!

By Dan on   Friday, September 21, 2007 2:55 PM

page naming conflicts

Bruce: site logs are getting filled with general exceptions... like this:

Message: System.Exception: Page naming conflict. Page at url (Default.aspx?=?tabid=125) has a duplicate url path to page with url (Default.aspx?tabid=-1&do301=true). Rename one or both pages to ensure uniqueness.

The site appears to be *working* fine... should I be worried?

By Dan on   Sunday, September 23, 2007 12:54 AM

also also

I am finding pages like:
http://mysite.com/Blog/.../name-of-the-article/+.aspx

hmm.

By Dan on   Sunday, September 23, 2007 3:04 AM

Problem with pageExtension attribute

Hiya,

There's a slight typo in the DNNFriendlyUrlProvider constructor: it tests for the presence of the pageExtension attribute, but then takes the result of ToString() on the Attributes collection, not the attribute itself.

Change:

If Convert.ToString(objProvider.Attributes("pageExtension")) <> "" Then
_pageExtension = Convert.ToString(objProvider.Attributes())

to:

If Convert.ToString(objProvider.Attributes("pageExtension")) <> "" Then
_pageExtension = Convert.ToString(objProvider.Attributes("pageExtension"))

This is looking really good!

Cheers,
Royston.

By Royston Shufflebotham on   Monday, September 24, 2007 12:01 AM

Bugs

@Dan

The exceptions you are finding is the duplicate page detection. The provider thinks you have a duplicate page path in your website. However I think from the exception detail that you probably have some deleted pages in your website which you have replaced with other pages with the same name. That's a bug, but you can get rid of the exceptions (and improve performance) by changing the checkForDupUrls attribute to "false". It's just meant to be a warning that you may have path conflicts.

As for your other problem, can you please post the url of the problem site in /default.aspx?tabid=mm format?

@Royston

Thanks for reporting that. Someone had already reported strange urls which appeared to be the type name of NameValueCollection - I hadn't yet looked at it but I know it's the same problem you've reported.

I'll fix it soon

By Bruce on   Monday, September 24, 2007 8:19 AM

urls

Thanks for the tip about the duplicate urls attribute.
As far as posting the url in the /defalut.aspx? format

without FURLs:
http://mysite.com/Default.aspx?tabid=127&articleType=ArticleView&articleId=5

with your current version FURL:
http://mysite.com/Blog/articletype/articleview/articleid/5/zscores-and-normative-data-what-iisi-normal/+.aspx

Of note, this page is a Ventrian News Article page...

By Dan on   Monday, September 24, 2007 1:52 PM

Incorrect Article Url

@Dan

Ok, I understand what the problem is with your site. The News article has an uneven number of parameters in it's url. The url rewriting is not handling that well. I'll have a look at it.

By Bruce on   Monday, September 24, 2007 5:20 PM

News Articles Pages

Bruce- there may be something funky going on at my end. I have three articles, TWO of them yield the funny url (article-title/+.aspx)

The third does not have the article title in the url, and it's page url is:
http://mysite.com/Blog/articleType/ArticleView/articleId/3.aspx
The article name is not showing at all...

DNN 4.4.1

By Dan on   Monday, September 24, 2007 10:29 PM

Incorrect Article Url

@Dan

Can you give me the actual address of the page so I can have a look at it? I'm not too familiar with how the Articles module works but I'll have a go.

By Bruce on   Tuesday, September 25, 2007 9:16 AM

my name is url

Sure thing- look at the articles on:

http://parameterz.com/Blog.aspx

By Dan on   Tuesday, September 25, 2007 10:00 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@Dan

I had a look at your site - wow and I thought url rewriting was difficult to understand. That content is waaay over my head.

Anyway, on the +.aspx - I've tested out my provider and it can handle an uneven number of query string parameters OK. The +.aspx on the end must be something to do with the way that the Articles module puts the title into the url. The + is just a url coded value of a space. I could write something to nix the space, but it might be necessary in the processing of a module to have a space in the query string. I'll write an email to Scott about it - he might be able to shed some light.

By Bruce on   Tuesday, September 25, 2007 3:51 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

All

I've put a new version in the download link. This has a fix for the incorrect page extension, plus three new features. They are the ability to make all url's lower case, output a 301 redirect if a url is not entered in lower case, and the ability to direct all requests to one subdomain (ie mysite.com -> www.mysite.com).

These settings are all optional (default is no lower case, no lower case redirects, and no subdomain redirects). All are controlled be entries into the web.config :
forceLowerCase="false"
redirectWrongCase="false"
redirectToSubDomain="www"

The updated version is available through the same download link.

By Bruce on   Tuesday, September 25, 2007 9:19 PM

over my head

Bruce: thanks for looking at my issue with the dangling +aspx. In addition to the articles themselves, you may have also noticed that when you click on a 'category' in Scott's Archive module, the url for the category also dangles it's extension: http://parameterz.com/Blog/articletype/categoryview/categoryid/4/ventricular-function/+.aspx


Regarding the content- it's all in what you're used to, I guess. Your work here is waaay over *my* head *grin*

Again,
Thanks!

By Dan on   Tuesday, September 25, 2007 10:48 PM

add pages?

ugh.
Trying to add a new page, and I am seriously stuck:
I cannot navigate to the new page
I cannot edit the page settings

Going to have to revert...

By Dan on   Wednesday, September 26, 2007 1:20 AM

Can't add pages

@Dan

Can you post your web.config entry for the friendly url provider? The problem could be in an incorrect setting.

By Bruce on   Wednesday, September 26, 2007 9:02 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

How nice. :(
MOST people run DNN on some sort of shared hosting, which means they can't use this. Few if any hosting companies will change things for individual customers.

By tom on   Tuesday, November 13, 2007 2:15 AM

Shared Hosting restrictions

Tom,

All functions for this provider, except removing the .aspx extension from pages, will work with shared providers. There is still plenty to offer for those on shared hosting. And I'm not sure what percentage of people use shared accounts, but it would be interesting to find out.. I've certainly assisted plenty of people to install this provider in their DNN setups who didn't have shared hosting.

-Bruce

By Bruce on   Tuesday, November 13, 2007 3:14 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I am trying to set this up on a dedicated 2003 server - however the extension format .* is not the correct way for 2003. There is a special section for the wildcard mapping at the bottom of the mappings screen.

See this article for details:
http://professionalaspnet.com/archive/2007/07/27/Configure-IIS-for-Wildcard-Extensions-in-ASP.NET.aspx

By Tim on   Wednesday, November 14, 2007 6:49 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Hi, can you add the option to replace spaces in the page name with a character such as a hyphen so pages would read: contact-us.aspx
This could really help seo on sites.

Also, trying this on version 4.7 with mixed results. I can't access settings page for any page, gives a 404. And the host settings pages errors with this:

DotNetNuke.Services.Exceptions.ModuleLoadException: D:\Websites\dnn\admin\Host\FriendlyUrls.ascx.vb(44): error BC30560: 'RewriterRuleCollection' is ambiguous in the namespace 'DotNetNuke.HttpModules.Config'. ---> System.Exception: D:\Websites\dnn\admin\Host\FriendlyUrls.ascx.vb(44): error BC30560: 'RewriterRuleCollection' is ambiguous in the namespace 'DotNetNuke.HttpModules.Config'.

By Dan Rice on   Monday, November 19, 2007 11:11 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Does your solution prevent the problem that Scott mentions of multiple links to things like removing duplicate URLs for tokenized things like register, terms, privacy, etc.?? I only have one DNN site so this does not affect me, but others may be interested to know. Thank you for mentioning that this will work on shared hosting.
Thanks, Tom

By Tom on   Tuesday, November 20, 2007 1:39 AM

4.7 Version, Multiple Links

@Dan

I haven't implemented space substitution, but I might do that when I do up a new release.

As for 4.7, looks like you've found a compatibility problem. I do recall reading on Scott McCullochs site a namespace conflict from 4.6 onwards, this may be that issue. I'll have to look at what he did to fix it and incorporate the changes. If you're into coding yourself you could read his site and see what the changes were.

@Tom
Yes this does do the same thing that Scott's does, because I started off with a copy of Scott's version and went from there. So there will be no duplicate register, terms, privacy fields.

-Bruce

By Bruce on   Tuesday, November 20, 2007 7:37 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@Bruce
I hope you can review the 4.7 compatibility issue soon. I planned to try this out but now apparently people can't try out yours or Ventrian's if they are on 4.6 or higher. My site-to-be is 4.7.

@Dan
Generally speaking it's a bad idea to use spaces in file names etc. for websites because these can get url-encoded as 20% and it makes your url longer and uglier.

Thank you, Tom

By Tom on   Tuesday, November 20, 2007 11:43 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@Bruce
I've taken your source and implemented space substitution using the tabname which so far is working ok, haven't tested on more than one site though. Will let you know if i can solve the 'RewriterRuleCollection' ambiguous error.

@Tom
What i refer to as space substitution is if i set the page name to "Web Design", DNN will show this page as "WebDesign" in the URL which isn't ideal for SEO. I think this is because it uses the tabpath stored in the Tabs table when creating the URL. I wanted it to use the tabname and replace spaces with a dash so that it would hopefully help SEO.

Cheers.

By Dan Rice on   Thursday, November 22, 2007 3:27 AM

New Version Released

@Dan
If it works well can you please send me the code to bchapman[at]ifinity.com.au - I'll look at integrating it into the next release if you like.

@All

I've uploaded a new version to this site and update the instructions above. It requires a whole new DLL to be dropped into the bin directory, and new updates to the web.config to use the new namespace I have compiled it in. Please give it a try and let me know if there are any issues, particularly in the Host Settings page.

By Bruce on   Thursday, November 22, 2007 11:43 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Hello, I know you posted a new download, but perhaps you should update your download page, which still shows an August date, and in another area there is no download link.
Thank you, Tom

By Tom on   Tuesday, November 27, 2007 5:42 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@tom

Put it down to the Documents module not actually reading the filename. I've fixed up the dates and I've put in the link.

By host on   Tuesday, November 27, 2007 7:35 AM

GetConfig Failed event

Hi Bruce, i've noticed this event appearing in the viewer:

UrlRewriter.RewriterConfiguration: GetConfig Failed
FilePath:
ExceptionMessage: Unable to cast object of type 'iFinity.DNN.Modules.FriendlyUrl.Config.RewriterConfiguration' to type 'DotNetNuke.HttpModules.Config.RewriterConfiguration'.

This happens when i go to the Host Settings page - and when i view the "Friendly URL Settings", they are empty - it appears not to be reading in from the config file. What i'm confused about is that i thought the Infinity dll replaced the GetConfig function but it appears to be using the HTTPModules version hence it's logging the event.

Dan.

By Dan Rice on   Wednesday, November 28, 2007 1:03 AM

Config Errors on Host Settings

Dan,

That is the compatibility problem I was trying to fix, but obviously only got half way. The problem is in the way the Host Settings page reads the FriendlyUrl Provider settings - it expects a certain type, and obviously a different provider does'nt have that type. I'll have a look and see if I can fix it

-Bruce

By Bruce on   Wednesday, November 28, 2007 8:16 AM

Bug

Line 652 in UrlRewriteModule.vb needs to be changed to:
If (tabDict.ContainsKey(tabKey.ToLower())) Then

Or you get the following error in the case of the tabkey only differing by case.


An item with the same key has already been added.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: An item with the same key has already been added.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +48
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +2585308
System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +10
iFinity.DNN.Modules.FriendlyUrl.UrlRewriteModule.AddToTabDict(Dictionary`2& tabDict, Dictionary`2& dupCheckDict, String httpAlias, String tabPath, String destParms, Boolean isDeleted, Int32& tabPathDepth) in D:\DotNetNuke\AuctionSite\source\Custom\DnnModules\UrlRewrite\HttpModule.UrlRewrite\UrlRewriteModule.vb:660
iFinity.DNN.Modules.FriendlyUrl.UrlRewriteModule.BuildTabDictionary(Int32& minTabPathDepth, Int32& maxTabPathDepth, Int32& minAliasPathDepth, Int32& maxAliasPathDepth) in D:\DotNetNuke\AuctionSite\source\Custom\DnnModules\UrlRewrite\HttpModule.UrlRewrite\UrlRewriteModule.vb:625
iFinity.DNN.Modules.FriendlyUrl.UrlRewriteModule.FetchTabDictionary(Int32& minTabPathDepth, Int32& maxTabPathDepth, Int32& minAliasPathDepth, Int32& maxAliasPathDepth) in D:\DotNetNuke\AuctionSite\source\Custom\DnnModules\UrlRewrite\HttpModule.UrlRewrite\UrlRewriteModule.vb:565
iFinity.DNN.Modules.FriendlyUrl.UrlRewriteModule.GetPathForRewrite(String url, Boolean& reWritten) in D:\DotNetNuke\AuctionSite\source\Custom\DnnModules\UrlRewrite\HttpModule.UrlRewrite\UrlRewriteModule.vb:333
iFinity.DNN.Modules.FriendlyUrl.UrlRewriteModule.IdentifyByTabPathEx(HttpRequest Request, HttpContext Context) in D:\DotNetNuke\AuctionSite\source\Custom\DnnModules\UrlRewrite\HttpModule.UrlRewrite\UrlRewriteModule.vb:316
iFinity.DNN.Modules.FriendlyUrl.UrlRewriteModule.ProcessRequest(HttpContext Context, HttpRequest Request, HttpServerUtility Server, HttpResponse Response) in D:\DotNetNuke\AuctionSite\source\Custom\DnnModules\UrlRewrite\HttpModule.UrlRewrite\UrlRewriteModule.vb:902
iFinity.DNN.Modules.FriendlyUrl.UrlRewriteModule.OnBeginRequest(Object s, EventArgs e) in D:\DotNetNuke\AuctionSite\source\Custom\DnnModules\UrlRewrite\HttpModule.UrlRewrite\UrlRewriteModule.vb:871
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


By Jeff Wilde on   Sunday, December 02, 2007 2:35 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Jeff,
That would be correct, if there was two pages with the same name differing only by case there would be a key conflict because the tab path is converted to lower case before being added to the dictionary. I can't see any reason why you'd have two pages differing only by case. That's not a good idea as far as search engines go. I'll change so that it scans for the error and logs an exception and doesn't throw a page error, but I wouldn't change the logic to allow for Page1 and page1 - it's far too confusing for users I think. Besides the module has an option to force all Url's to lower case - it was a popular feature request from users.
-Bruce

By Bruce on   Monday, December 03, 2007 8:36 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I tried this -- it did not make terms and privacy friendly enough -- the vanilla DNN friendly urls renders these as terms.aspx and privacy.aspx, your rewriter includes the /something/ctl part of these urls.
Thanks, Tom

By Tom on   Thursday, December 06, 2007 10:50 AM

Config Errors on Host Settings

@Tom

I'll check that out, but to me the main benefit with terms and privacy is removal of them as a duplicate link. Having the 'ctl' part in it isn't a big deal for search engine indexing. I'm working on a way to show terms and privacy and convincing search engines to not index the content. Type in a key phrase from the standard DNN privacy statement and you'll get LOTS of hits.

-Bruce

By Bruce on   Thursday, December 06, 2007 11:06 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Oh, I don't care if it indexes P and TOS or not.
I forgot about that duplicate removal feature, I will try putting yours back when I have some content to work with, since I know people don't read those things too much.
Whenever you have time (or maybe someone else more experienced than I) perhaps you could indicate a little more which settings are "recommended" especially for shared hosting, and which for smaller/new sites etc., this is not a big deal, it may help people who are new to your product, for example, I had to find out by trial and error that the 'www' subdomain feature is something I probably don't want.
I know the DNN search itself does not index TOS and P, someone told me this on the DNN 'human friendly' blog.
Please keep up your great work on this project!!
Thanks, Tom

By Tom on   Friday, December 07, 2007 2:12 AM

Recommended Settings

@Tom

Good point about a 'recommended settings'. I guess it is a bit bewildering with the array of options. I did put a readme in with the download, perhaps I'll expand this further. I've got another version in test at the moment which seems to fix the Host Settings exception problem, as well as adding in replacing spaces with a specific character (as kindly supplied by Dan). I'l post here when it's uploaded.

-Bruce

By Bruce on   Monday, December 10, 2007 9:06 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

When might the version mentioned 12-10 with the replacement of spaces be available?

By Alex on   Tuesday, December 18, 2007 10:13 PM

New Version

@Alex

I have just uploaded the new version to the downloads section. You can download it using the existing links.

There is a new option called 'replaceSpaceWith' which allows you to specify a character with which to replace a space in the page name.

NOTE: if you install this version, please move the 'old' DotNetNuke.HttpUrlRewrite.dll out of the \bin directory or you will get an error when you view the Host Settings page in your DNN site.

By Bruce on   Tuesday, December 18, 2007 10:39 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

does anyone have the replace spaces with - working? I get 404's when I add this parameterl HOwever, if I type it in directly, like domain-name.aspx, it works. All of my existing pages that had spaces generate 404s,

By Alex on   Tuesday, December 25, 2007 11:11 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I noticed on the download page, the date is 12-18, but when I open the file, they are dated 12-10. Maybe this is the issue.

By alex on   Tuesday, December 25, 2007 11:21 AM

replaceSpaceWith option not working

First let me say that I really appreciate the URL Rewriter mod. It works fine without the replaceSpaceWith option in use but when I add that option I start having links go bad. What happens is that a page with a title of 'Get Started' gets converted to /get_started/ (I specified underscore) but the links from the menu point to /getstarted/ instead. So that links appear broken but adding the underscore brings up the page. So I guess it is half working.

For a future enhancement, it would be nice if it worked better with Scott's News Article module. For the best SEO the ideal path would be something like this... www.domain.com/articles///

By Bryant on   Wednesday, December 26, 2007 12:55 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Thanks all for the feedback on the replace spaces problems. I'll work on a fix for the reported problems and post a new version. The call from one of the NavigateUrl() overloads mustn't be formatting the page correctly.

By Bruce on   Saturday, December 29, 2007 2:24 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I also want to give my sincere thanks to Bruce for these modifications, as well as to Scott for writing this. Once the replace with "space-character" problem is working, I will also post on the DNN forums and see if we can get these changes all put into the core.They should form a URL team, with Bruce and Scott as members. Everyone that uses this re-writer should post their site here. We can then point to them on the DNN forums so that the community will want these changes in the core.

By Alex on   Saturday, December 29, 2007 7:32 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Bruce, thanks for taking a look at the replace space issue. In my previous post I also mentioned it would be nice, if possible, to also rewrite the URL for Scott's News Article module. Article content really helps get our site ranked well and a better URL will improve those pages ranking. The sample path in my previous post got lost though. Ideally it would look something like this... www.domain.com/articles/category/article-title/ or something similar. The idea is to get the category name (most important) and possibly the title in there as well. Let me know what you think. I'd be willing to help if you can point me in the right direction. Thanks

By Bryant on   Monday, December 31, 2007 1:48 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Hello Bruce,

Can your solution work with a DNN webpage which has the & special character??

I need to use a page name and title such as Foo & Bar for two of the pages on our DNN site, otherwise I can only use single-word page names/titles.

The default DNN friendly URLs will render it as .../fooampbar.

Alternatively I need a way for the page name to be just Foo, but the title display as Foo & Bar.

Thank you, Tom

By Tom on   Saturday, January 05, 2008 5:23 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Can your solution have a user-defined rule which does not allow & or amp to be part of the page name even though & is part of the page title?? Or alternatively I can use the numeric value, &...

DNN for HFURLs uses the page title.

Thank you, Tom

By Tom on   Saturday, January 05, 2008 5:33 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Hey Bruce. Just loving this URL Rewriter module you have come up with. I wanted to pass along that I have been doing some testing on DNN 4.8.0 with it and the Host Settings page issue is back. I also tried to pull up the "All" filter on the User Accounts page and it came back with nothing. I know I have users on my portal so there is another break. I haven't checked any other admin pages as I needed to get testing on other systems. Wanted to pass it along as I would love to see this move forward.

Jared

By Jared on   Monday, January 07, 2008 4:35 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I hate to ask since you are donating this for free..... but.... are you close to a release on this with the issues in the last few posts resolved?
Your efforts are certainly appreciated in the community.

By Alex on   Thursday, January 10, 2008 12:04 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@Alex

I'm hours away from putting up a new release fixing all the bugs brought up here, plus I've put in a few enhancements as well. Sit tight and check back later on today. I'll announce it in the DNN blogs as well.

By Bruce on   Thursday, January 10, 2008 8:27 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

OK I have uploaded new versions - see the updated blog entry above. There are now two separate version of the files, to account for the change in the way the HttpModules are handled from DNN 4.6 onwards. If you are running 4.6 +, then use the 4.6 version. If you are using 4.0 - 4.5 then use the 4.5 version.


Friendly Url Provider 4.5



Friendly Url Provider 4.6


The source code for both versions is on the downloads page


In answer to queries


@Bryant : This new version handles Scott's Aritlces module better.
@Alex : I have fixed the problem with the replace-spaces issue. Version control got the better of me and I released the wrong one. Oh, and Scott is on the core team for Friendly Url's. I don't know if any of my ideas have been taken up, I don't mind having a cottage industry in more advanced rewriting though :)
@Jared : The host settings errors in version 4.6-4.8 have been fixed (use the 4.6 version of the Friendly Url Provider) The 'all users' thing sounds like a separate issue - it tested OK for me.

I'll be writing a new entry and converting this website to use the provider, then I'll post to the DNN forums with the updates in case anyone wants to try the new version.

By bchapman on   Thursday, January 10, 2008 3:24 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Hi,
We still can't get the replace with spaces to work. With both versions 4.5 & 4.8, tt ignores the spaces, but if we type in the url directly with a dash - (the replace character) .... The page is found...
On DNN ver 4.8 the host menu does not work, on version 4.5 (with the 4.5 version) the host menu does work.

Also, seems like someone made a commercial module based on this code...
http://www.snowcovered.com/snowcovered2/Default.aspx?tabid=242&PackageID=8262

The GUI screens are nice as is the 404 option, maybe a future enhancement.... :-)

By Alex on   Friday, January 11, 2008 5:08 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@Alex

After you upgrade the version, you should restart your applicaiton. Normally this is done for you by editing the web.config, but if you didn't, the old cache of the page names will still exist, and you'll need to rebuild it. So if you haven't done so, restart your application and see if the page names start coming out correctly.

You must match the version to the DNN Version you are running. If you are running DNN 4.0 - 4.5, you must use the 4.5 version of the FriendlyUrl provider. If you are running 4.6-4.8, you must use the 4.6 version of the provider.

I've thought about including GUI screens, but it is something you tend to set up only once, so I don't think it is worth it. I'm pretty sure that their commercial module was around before I started working in this space - who knows, maybe they did use some of my ideas.

By bchapman on   Friday, January 11, 2008 8:49 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

You should make a GUI for it, as it would be great to sell to clients who can't do that sort of updating, so when they create a new page, they could set what the URL should be very easily. Like the ability to make a page name be long but keep the URL short

By Joe Sak on   Saturday, January 12, 2008 5:46 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

How could I use this module to 'redefine' some of my URLs??
For example, in our HTML site, I have a page called 'mission.html,' with a title and H1 text that says 'Mission & Values.'
DNN forces me to use 'Mission and Values' for both the title and the page name.
Can either this or the DNN friendly URLs make the page link become mission.aspx instead of MissionandValues.aspx??
Instructions on this would be quite helpful.
Thank you, Tom

By Tom on   Friday, January 18, 2008 2:24 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Wow, I can't believe I just found this now ... excellent job Bruce! A few comments:

* I've got one site with lots of tab names containing "&" such as "Tours & Packages" ... which gets rewritten to /tourspackages.aspx instead of /tours-packages.aspx ... anything I can do about that?

* DNN Event Viewer is full of this:
Page naming conflict. Page at url (Default.aspx?=?tabid=xxx) has a duplicate url path to page with url (Default.aspx?tabid=xxx&do301=true). Rename one or both pages to ensure uniqueness.

* File Upload via DNN Filemanager throws this error
DotNetNuke.Services.Exceptions.ModuleLoadException: Requested value 'file' was not found. ---> System.ArgumentException: Requested value 'file' was not found. at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) at DotNetNuke.Modules.Admin.FileSystem.WebUpload.get_FileType() at DotNetNuke.Modules.Admin.FileSystem.WebUpload.Page_Load(Object sender, EventArgs e)

But enough with the "complaining" ... Bruce, do you have a "Donate" button somewhere? You need to be seriously rewarded for this!

By Tom Kraak on   Friday, January 18, 2008 3:20 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@Joe - I'm working on it. I've had enough requests to support custom Url names for Tabs that I'll start to look at it.
@Tom (1) - You're talkign about the same thing as joe - the ability to specify the Url for the tab, so same answer - i"m looking at it
@Tom (2) - Glad you like it.
1- I have a new version that I haven't put up yet which should fix your problem (of replacing '&' with '-'). I'll post to this blog entry again when I've got the new one up. I get plenty of bug reports :)
2- This is a warning to tell you that you have different tab paths on the website where the names resolve to the same thing. Without looking at your site I can't tell you which they are. You can turn off the exceptions in the log by setting 'checkForDupUrls=false' in your web.config, but you should probably satisfy yourself that your portal alias/page name combinations are all unique.

3- Not sure why your file manager isn't working. I've struck a similar problem once with one website, I thought it was a problem with the setup, I"ll take a closer look.

4- Donations? Well, if you like it just link to this page and that's thanks enough. I'm probably going to put together a commercial module version which is easier to use.

-Bruce

By Bruce on   Friday, January 18, 2008 4:10 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

custom url names for tabs: could be possible with regexes?? though one would need to know how to spec the regex??
I also would like to be able to use & in page names etc. -- but please remember that the correct HTML way for ampersand & is either & or &.
If you implement the ability to manage extended characters with your app, you will get a monopoly on the international DNN market, many languages need extended characters to render properly in English writing.
I wasn't real successful with your app the first time I tried it, I will try it again and see what happens.
I appreciate your taking time to keep working on this project.
Thank you, Tom

By Tom (1) on   Saturday, January 19, 2008 4:54 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Thanks Bruce ... I for one can't wait for the new release including custom URL names for tabs.

Here is one of my sites running your provider:
http://www.gotocentraleurope.com/

Just to be sure I conveyed this clearly ... it's not the DNN File Manager itself, but rather the File Upload page triggered from the File Manager:

Error: File Upload is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: Requested value 'file' was not found. ---> System.ArgumentException: Requested value 'file' was not found. at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) at DotNetNuke.Modules.Admin.FileSystem.WebUpload.get_FileType() at DotNetNuke.Modules.Admin.FileSystem.WebUpload.CheckSecurity() at DotNetNuke.Modules.Admin.FileSystem.WebUpload.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace ---

--------------------------------------------------------------------------------

Unhandled error loading module.
DotNetNuke.Services.Exceptions.ModuleLoadException: Unhandled Error Adding Module to ContentPane ---> System.ArgumentException: Requested value 'file' was not found. at System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) at DotNetNuke.Modules.Admin.FileSystem.WebUpload.get_FileType() at DotNetNuke.Modules.Admin.FileSystem.WebUpload.Page_Init(Object sender, EventArgs e) at System.Web.UI.Control.OnInit(EventArgs e) at System.Web.UI.UserControl.OnInit(EventArgs e) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.InitRecursive(Control namingContainer) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---

And here is the link love you've been asking for :}-
http://seablick.com/blog.aspx

By Tom Kraak on   Saturday, January 19, 2008 3:09 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Hello,
I have been informed of your new module by Seablick consulting.
What about localisation ?
My pages are in french and in english, how do you handle such cases ??

DV FX - http://declic-video-fx.com

By Déclic Vidéo FX on   Sunday, January 20, 2008 4:35 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@Tom K
I've confirmed that this is a bug. Your workaround until I post the fix are either: 1) turn off 'forceLowerCase' or 2) manually change the parameter 'file' in the query string to 'File' when you get to that page. The core code for the web upload page expects the query string parameter to be in the correct case. The force lower case option stuffs this up. Thanks for the link!

@declic
I'm not sure about localisation - theoretically it shouldn't make a difference, if you can try it on a test site and let me know if there are any problems I can address it.

By Bruce on   Wednesday, January 23, 2008 1:50 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Thanks for looking into the web upload page ... your suggested workarounds will work fine for now.

Looking forward to the new release :)-

By Tom Kraak on   Thursday, January 24, 2008 1:43 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I can´t seem to get it to work. I can access the homepage just fine but all other pages return 404. I am trying it on a web that runs as localhost on my pc running WinXP, not sure if that may be the cause.

By Stephan on   Friday, January 25, 2008 8:59 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

There is no reason why it will not work with Xp, it has been tested on a localhost/xp install.

The reason your homepage works is probably because it is specified in the siteurls.config file, which the standard provider uses. My suggestion is to recheck your web.config settings again carefully, restart your IIS and try again.

By Stephan on   Friday, January 25, 2008 4:13 PM

Config Error

@Gus

That error is most likely a web.config error of some description - probably invalid Xml caused by an unclosed tag or an invalid character. There should be something in the windows event log to tell you what the problem is, try adding the changes again to a fresh copy of the web.config.

-Bruce

By Bruce on   Friday, January 25, 2008 10:44 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I got it to work. Problem was I was using the wrong version. I downloaded from the updated link on top of this page but that version is an older version. When I downloaded from the downloadpage it worked. MAybe you can take the links to the older versions down to prefent confusion. Thanks!

By Stephan on   Saturday, January 26, 2008 4:37 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I am using localization and when I setup url rewriting urls turn out like this: \shop\products\language\en-us.aspx In this example I would like it to be: \shop\language\en-us\products.aspx. Any thoughts on how to go about this?

By Stephan on   Saturday, January 26, 2008 5:31 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Bruce,
first I want to say excellent work - much appreciated!
I just wanted to say that I had bought the DNNMasters commercial module mentioned above but i got a refund because it is not working when SP1 for ASP.NET 2.0 is installed. They are working on a fix but it may take a while...
I'm sure if you make a commercial version available it will be success!

By Emil on   Tuesday, January 29, 2008 6:00 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Hi, it is very nice to read about this module. I have tried it but no success. I am using DNN 04.07.00. Here i write what i did: 1- I downloaded the iFinity.FriendlyUrlProvider.dll + iFinity.FriendlyUrlProvider.pdb and copied these two files in Bin directory. 2- Then I edited my web.config file as you wrote in your example.web.config. Here are what I edited in provider section:



3- Then I tested web links in browser and I thought the link www.itdeal.info/cms/tabid/161/Default.aspx would get the friendly url like www.itdeal.info/cms/AboutZacco/WhoWeare but it came 404, The page can not be found.

Could you please help me, where and what I am doing wrong. Your help would be deeply appreciated. You can also contact me at paijyj@gmail.com Thanks a lot

By Javed Iqbal on   Wednesday, January 30, 2008 6:52 AM

404 Errors

@Javed

There are two changes that need to be made to the web.config. You have done the FriendlyUrl entry OK, which is why you are getting friendly URl's back. You also have to do the HttpModules section as well, and change the 'UrlRewrite' section. Basically you are producing the new friendly Urls but you haven't given the site a way of decoding them until you also configure the UrlRewriting section. Two functions, one dll. Also make sure you have the latest version for download, to be sure grab it from the free downloads page.

-Bruce

By Bruce on   Wednesday, January 30, 2008 8:04 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

I have download "iFinity.FriendlyUrlProvider_04.06.07_Install.zip" file but it failed to extract.
I can't see the content.
My winZip is working fine with other zip files.
Is there anything I missed to get FriendlyUrlProvider dlls

By Amit on   Wednesday, February 20, 2008 11:57 AM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Amit

You may have a faulty download which has resulted in an incorrect zip file. I'd try downloading the file again and retrying.
-Bruce

By host on   Wednesday, February 20, 2008 12:00 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

it still has problem.
can u email me a1[underscore]uchat[at]yahoo[dot]com

By Amit on   Wednesday, February 20, 2008 1:39 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@Amit

Sorry, right you are. There was a corruption in the MIME header with regards to file size, which results in a corrupt ZIP file. I've fixed the problem, you should be able to download OK.

Sorry about that
-Bruce

By bchapman on   Wednesday, February 20, 2008 1:40 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Ok I now I got dll, pdb and sample web.config.background: I am upgrading current portal from 4.05.0 to 4.08.0 and working on clonned portal.I did following after unzipping install zip to dnn root folder1) I removed my existing DotNetNuke.HttpModules.UrlRewrite.dll file2) Copy the iFinity.FriendlyUrlProvider.dll in to the /bin directory.3) Replace with this entry: 4) Replace the existing ''DNNFriendlyUrl'' provider section

And when I try to build website I still get following errorC:\sourceCode_plus_4_08_0_install\source\BackChannelPortal\admin\Host\FriendlyUrls.ascx.vb(44,0): error BC30560: 'RewriterRuleCollection' is ambiguous in the namespace 'DotNetNuke.HttpModules.Config'.
I have already spent great deal of time after upgradation and still not done. Any thoughts, ideas or experience would be really appreciated.-Amit

[administrator edit for comment size]

By Amit on   Wednesday, February 20, 2008 2:02 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@amit
In the future, please post your technical questions in the support forums. But the answer to your question is: delete the old DotNetNuke.HttpModule.UrlRewrite.dll file. In 4.8 this file is no longer needed, but it isn't removed in the upgrade.

There is also an error in the example web.config that I haven't corrected. Where it says .\png it should say \.png - correct this while you are at it.
-Bruce

By bchapman on   Wednesday, February 20, 2008 2:04 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Value cannot be null.
Parameter name: type
I amgetting this errormessage Could u please help me..

By Harsha on   Thursday, August 07, 2008 8:07 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

Harsha
- please post your support questions to the Support Forums. You'll also need to be a lot more specific than what you have described. Which version, what version of DNN. What was the Url you are requesting - as much information as you can provide.
-Bruce

By bchapman on   Thursday, August 07, 2008 11:12 PM

Adding pages and copying pages doesn't work

Hi,

I used the "iFinity.FriendlyUrlProvider.dll" to remove the .aspx at the end of the link of the site that I am assigned to work on and it removes the .aspx successfully. My problem is that I am having errors on adding new pages copying pages editing the other URL's in the admin. I have the sa error with "Tom K". The version of the DNN that I'm using is 04.05.03.

Thanks.

By almarjin on   Tuesday, March 10, 2009 8:28 PM

Re: Rewriting the DotNetNuke Url Rewriter Module - Again

@almarjin please post your support questions to the products->support forums. You'll probably need to restart your DNN install to pick up your new pages

By Bruce Chapman on   Thursday, March 12, 2009 7:19 AM

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 
Bruce Chapman
Hi, I'm Bruce Chapman, and this is my blog. You'll find lots of information here - my thoughts about business and the internet, technical information, things I'm working on and the odd strange post or two.