Forum


HomeHomePublicPublicDevelopmentDevelopmentCustom URL Rewriting / Redirects for MVC ModuleCustom URL Rewriting / Redirects for MVC Module
Previous
 
Next
New Post
7/24/2017 10:18 PM
 

Hello,

Hopefully someone can assist with this request...

We have developed a simple MVC module which has a list and a detail view.

On the detail view there is a URL structure such as:
http://www.domain.com/About/Staff/StaffId/355

The client would like the ability in the "Edit item" screen to be able to give a custom URL for this item.

So for example, when adding or editing a staff member they would add their name, bio image etc.

And one of the fields would be "Custom URL Path" which they could set to be the just the persons first name eg - "Bill".

This would mean that when you navigated to a page such as 

http://www.domain.com/Bill

You would be redirected to:
http://www.domain.com/About/Staff/StaffId/355

 

Currently we do this manually be editing the IIS redirect rules, which in turn modifies the web.config file.

Two downsides of this are, the site restarts everytime the web.config file is altered.

And the client cannot add these custom URLs themselves.

I would appreciate it if anyone has any insight or input on this matter.

Thanks in advance


 

 
New Post
7/25/2017 2:58 AM
 

Our tutorial, Building a URL Extension Provider for DNN, covers exactly what you need.  You can create an extension provider and package it with your module.  You can handle automated Url rewrites and redirects.  In the case you mentioned, you would have a cached listing of all staff url "slugs" (ie: "Bill") with a mapping to the staff Id.  If the Url path matches your slug, you can rewrite the url with the staff id, /about/staff/staffid/355.  The tutorial above has an example extension provider for a blog module, but it translates nicely to your problem.

 
Previous
 
Next
HomeHomePublicPublicDevelopmentDevelopmentCustom URL Rewriting / Redirects for MVC ModuleCustom URL Rewriting / Redirects for MVC Module



Try FREE
30 days money back guaranteed