Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...URL RewriteURL Rewrite
Previous
 
Next
New Post
12/17/2012 7:22 PM
 
Hello Everyone,I realize there are various >$100 modules that will handle rewriting easily, but I would definitely like to look at utilizing the built in functionality of DNN, and later leveraging the IIS if necessary. I am trying to send to the URL of a module for my site given a URL that does not include the ID within the URL.http://localhost/alecu/Log/tabid/93/post/this-is-another/Default.aspxtohttp://localhost/alecu/MyBlog/post/this-is-another/Default.aspxThis is what I have so far, and it doesn't work. I had assumed that it would rematch which was my fault. Does anyone know of a smarter way to do this? [^?]*/TabId/(\d+)(.*) ~/Default.aspx?TabId=$1 [^?]*/MyBlog/(.*) ~/alecu/Log/tabid/93/$1 Kind Regards,Kevin
 
New Post
12/17/2012 10:44 PM
 

My fault for using the basic text editor and expecting it to keep Newlines! Original Message:

Hello Everyone,I realize there are various >$100 modules that will handle rewriting easily, but I would definitely like to look at utilizing the built in functionality of DNN, and later leveraging the IIS if necessary. I am trying to send to the URL of a module for my site given a URL that does not include the ID within the URL

http://localhost/alecu/Log/tabid/93/post/this-is-another/Default.aspxto
http://localhost/alecu/MyBlog/post/this-is-another/Default.aspx

This is what I have so far, and it doesn't work. I had assumed that it would rematch which was my fault. Does anyone know of a smarter way to do this?

RewriterRule>
     LookFor>[^?]*/TabId/(\d+)(.*)</LookFor>
      SendTo>~/Default.aspx?TabId=$1</SendTo>
 /RewriterRule>
 RewriterRule>
     LookFor>[^?]*/Log/(.*)</LookFor>
    SendTo>~/alecu/Log/tabid/93/$1</SendTo>
/RewriterRule>

Kind Regards,
Kevin

 
New Post
12/17/2012 11:07 PM
Accepted Answer 

For anyone else that may be wondering out how to do this, I've resolved it myself. It's really quite simple but only when you aren't trying to think of a difficult way around it. Basically what I did was look at the path:

http://localhost/alecu/Log/tabid/93/post/this-is-another/Default.aspx

And realized it was already a product of a FriendlyURL rewrite. So inside of the Host Settings I turned off FriendlyURLs and then revisited the blog page and received the following:

http://localhost/Default.aspx?tabid=93&post=this-is-another

Now that I knew what it looked like (what the querystrings where) I could easily rewrite it as it needed to be, which ended up like this through the backend (Host Settings->Advanced Settings->Add new rule):

MATCH: [^?]*/blog/post/(.+)
REPLACE: ~/Default.aspx?TabId=93&post=$1

I left the TabID as 93 since that is the TabID of my blog module. I then added a second rule following that with:

MATCH: [^?]*/blog/(.*)
REPLACE: ~/Default.aspx?TabId=93

Which will replace any redirect /blog with anything after it that isn't a post to this page. Admin side editing still uses standard DNN. The last bit was to change the ASCX file to generate the new format URLs (this URL for TabId/93 and normal style for anything else). I know this is probably trivial and not news for many of you, and for those of you who have already paid for a solution it is completely irrelevant. Hopefully it helps lead someone down the right track if, like me, they were having a difficult time with a simple chore.

Kevin


 
New Post
12/17/2012 11:31 PM
 

Kevin - your solution will work, although you will have to maintain your custom version of the .ascx code.

One thing you skipped, however, was that you don't need the /default.aspx on the end of the post either.   You can just end your blog post with /this-is-the-title.aspx.  The default.aspx is essentially just a placeholder, putting it on the end of a Url to be rewritten doesn't have anything do with with the rewritten Url starting with /defualt.aspx.

That will simplify your Urls a bit more.

I don't really suggest this type of one-off customisation for most people, as it isn't flexible in terms of upgrades and changes.  But if you're happy to tweak things a bit like this, no real harm done.   You might also want to look at a redirect rule if your blog psots are already established, to redirect any of the old style Urls back to your new style.  This can also be done via the Friendly Url Section in the host settings.

 
New Post
12/18/2012 8:07 AM
 

Hello Bruce,

Thanks for the reply! Yes, the largest annoyance is the maintaining of the ASCX when I upgrade the module (even though there are no current plans to upgrade, we all know it happens). I was trying to think of an elegant solution around that, and it may be something that the paid solutions actually have a large advantage in.

As to your comment about ASPX, that was what I initially was going for, as you see from my response though my matches don't require that:

MATCH: [^?]*/blog/post/(.+)
REPLACE: ~/Default.aspx?TabId=93&post=$1
Resolves from: http://domain.com/blog/post/this-is-my-post

MATCH: [^?]*/blog/(.*)
REPLACE: ~/Default.aspx?TabId=93
Resolves from: http://domain.com/blog/

Which is a good thing! I do understand your trepidation concerning the maintainability when it comes to upgrades and changes, and if I find that my sites grow beyond two or three that I may move to a dedicated solution. Now, you mention redirecting via the Friendly Url section from the old style to the new style, I've found that this doesn't seem to work well -- but it appears that the rules cannot parse out to another rule without failing. Is there something I'm missing?

I see that you are with the development of URLMaster -- would I be correct in assuming that it would allow me to not worry about modifying the ASCX file and achieve the above result (sans TabID) and then also resolve all in-module clicks?

Kevin


 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...URL RewriteURL Rewrite


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out