Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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 ...formatting DNN website URLsformatting DNN website URLs
Previous
 
Next
New Post
10/15/2009 6:01 AM
 

I'm moving my existing website over onto DNN, but I do not want old links to my site to break. The format of my urls on my past system was: "www.example.com/writing-good-examples/like-this", whereas in DNN this would be "www.example.com/WritingGoodExamples/Likethis". Is there any way I can format the way DNN creates its urls so that I can display them in the old way? I don't want to have to create hundreds of redirects...

 
New Post
10/16/2009 2:32 PM
 

URLMaster by ifinity.com.au can help you do this.

 
New Post
10/20/2009 4:59 AM
Accepted Answer 

I've found a fix. If you edit the TabPath row of the Tabs table in your database, then you can format how that pages url is displayed. This only works for existing pages, so you could write a script to update the row in the database for you if you had a similar problem to mine.

 
New Post
10/20/2009 7:21 PM
 

Hi Stefan

While your fix will work as described, you can run into problems down the track when you start editing and moving pages around.  You will need to check that the tabpath value doesn't get overwritten if you save a change to your page settings.

-Bruce

 
New Post
11/3/2009 5:31 AM
 

Thanks for the reply, Bruce. I've written a couple of functions to deal with the problem.

Firstly, the tab path formatting function:

-- =============================================
-- Author:        Stefan Benjamin
-- Create date: 02/11/2009
-- Description:    Create a formatted TabPath for records
-- =============================================
ALTER FUNCTION [dbo].[formTabPath]
(
    -- Add the parameters for the function here
    @TabId int
)
RETURNS varchar(max)
AS
BEGIN
    -- Declare the return variable here
    DECLARE @TabPath varchar(max) = ''
    DECLARE @Level int = (SELECT [Level] FROM dbo.TabsCopy WHERE TabId = @TabId)
    DECLARE @TabName varchar(max)
    DECLARE @ParentId int
   
    -- Add the T-SQL statements to compute the return value here
    WHILE @Level >= 0
    BEGIN
        SET @TabName = (SELECT TabName FROM dbo.TabsCopy WHERE TabId = @TabId)
        SET @ParentId = (SELECT ParentId FROM dbo.TabsCopy WHERE TabId = @TabId)
        SET @TabPath = dbo.StripPunctuation(@TabName) + @TabPath
        SET @TabId = @ParentId
        SET @Level = @Level - 1
    END
   
    -- Return the result of the function
    RETURN @TabPath

END

 

Secondly, my function to strip punctuation from tab titles, change spaces to dashes and add the "//" before each level:

-- =============================================
-- Author:        Stefan Benjamin
-- Create date: 02/11/2009
-- Description:    Strips punctuation from string and replaces spaces with dashes
-- =============================================
ALTER FUNCTION [dbo].[StripPunctuation]
(
    -- Add the parameters for the function here
    @TabName varchar(max)
)
RETURNS varchar(max)
AS
BEGIN
    -- Declare the return variable here
    DECLARE @LevelName varchar(max)

    -- Add the T-SQL statements to compute the return value here
    SELECT @LevelName = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(@TabName,',',''),'.',''),'''' ,''),'!', ''),'&', 'and'),' ', '-')

    -- Return the result of the function
    RETURN '//' + @LevelName

END

 

Hope this helps people :)

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...formatting DNN website URLsformatting DNN website URLs


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