2
votes

I want to create dnn custom module that will redirect some old url-s to new pages. I know how to create datatable and add records to this table. The table have old-url and new-url fields with required data. eg.: www.domain.com/oldurl, www.domain.com/newurl

if I use redirect inside module view then I can only redirect existing pages to new pages and for this I don't need to make custom module...

My question is: what to override or use that I can intercept request and make redirect with custom dnn module?

===== EDIT =====

I also find this : dnnurlproviders https://archive.codeplex.com/?p=dnnurlproviders Is this still maintained somewhere?

2

2 Answers

3
votes

You could also do this without writing a module, and simply adding records to the TABURLS table in DNN.

INSERT INTO dbo.TabUrls (   TabId ,
                            SeqNum ,
                            Url ,
                            QueryString ,
                            HttpStatus ,
                            CultureCode ,
                            IsSystem ,
                            PortalAliasId ,
                            PortalAliasUsage ,
                            CreatedByUserID ,
                            CreatedOnDate ,
                            LastModifiedByUserID ,
                            LastModifiedOnDate
                        )
VALUES (   ###,         -- TabId - int
           3 ,         -- SeqNum - int
           N'/OLDURLHERE' ,       -- Url - nvarchar(200)
           N'' ,       -- QueryString - nvarchar(200)
           N'301' ,       -- HttpStatus - nvarchar(50)
           N'' ,       -- CultureCode - nvarchar(50)
           1 ,      -- IsSystem - bit
           null ,         -- PortalAliasId - int
           0 ,         -- PortalAliasUsage - int
           1 ,         -- CreatedByUserID - int
           GETDATE() , -- CreatedOnDate - datetime
           0 ,         -- LastModifiedByUserID - int
           GETDATE()   -- LastModifiedOnDate - datetime
       )
1
votes

The answer for making custom redirect is to create custom ExtensionUrlProvider.

Some helpful links are:

http://www.dnnsoftware.com/answers/getting-started-with-dnnfriendlyurl-in-dnn-72x

http://www.dnnsoftware.com/answers/custom-extensionurlprovider

and settings for custom ExtensionUrlProvider missing in dnn 9.0.0 and after dnn 9.0.1 are at:

SEO > URL Management

https://dnntracker.atlassian.net/browse/DNN-9148?attachmentOrder=desc

===========================

also for handling redirect for old .php links in iis you must create new Handler Mappings in IIS. Just take PageHandlerFactory and copy it with *.php Path.