Search code examples
dotnetnuke

dnn - Custom module for unexisting page redirect


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?


Solution

  • 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
           )