Some pages redirecting to the wrong URL

Overview

If some (but not all) of your pages are redirecting to an incorrect host (for example, localhost or an older URL), the problem may be in your SEO Page Redirect URLs. Since page redirects are controlled from the settings of the redirect target page, if the redirect target page has been deleted or is located on a different portal, you may not be able to remove the page redirection from the UI. In those cases, you can use SQL to remove the redirect directly from the server.

Terminology note: "Tab" is the database name for a web page. Throughout this article, tab and page will be used interchangeably.

 

Solution

To complete these steps, you will need:

Stage 1: Remove page redirects in the UI if possible

  1. You can follow the directions in the article Remove a Page Redirect to ensure that only the correct redirects are in place.

Stage 2: Remove page redirects from the SQL server

  1. Back up the site and the database.
  2. Go to Persona Bar > Settings > SQL Console.
  3. Find the identifier (TabID) of the problematic page.
    • Run the following SQL script:
      SELECT TabID FROM tabs
      WHERE TabName = '@NameOfPage'
      where @NameOfPage is the name of the page.
    • Note that TabURLs are stored with reference to the target page. That page may not exist in the UI, but it will exist in this table. Take special note of the PortalID for a given page, as that may help you distinguish it from a similarly-named page on a different portal.
    • You should also pay special attention to tabs that exist on non-public or decommissioned portals. It could be that in the next steps you will find page redirects pointing at incorrect or outdated portals. These may need to be removed.
    Note: You will need the TabID returned by the query in the following steps.
  4. From here, you can either delete all redirects related to the page or delete specific page redirects one-by-one.
    1. To view your current page redirects, run the following query:
      • SELECT * from taburls
        WHERE httpstatus = 301
      • You'll want to take special note here of redirects going to non-existent pages (tabIDs). These may need to be removed (see Step 3 below).
    2. To delete all redirects, run the following SQL script:
      • DELETE FROM taburls 
        WHERE TabID = @X AND HttpStatus = 301 
      • where
        • @X is the identifier of the page.
    3. To delete specific redirects, run the following SQL script:
      • DELETE FROM taburls 
        WHERE Tabid = @X AND HttpStatus = 301 AND Url = '@Y'
      • where
        • @X is the identifier of the page, and
        • @Y is the URL to remove.
  5. Once these changes have been made, clear the DNN cache and restart the application.

 

Testing

Navigating to a redirected URL should correctly redirect to the desired page.

 

Comments

0 comments

Please sign in to leave a comment.