Managing URLs in DNN (DotNetNuke) is crucial for ensuring clean, SEO-friendly URLs and providing a better user experience. The process involves using URL rewrite modules, custom rules, and external tools to handle URL structure and redirection effectively.
Key Resources for DNN URL Management
-
DNN URL Management on Codeplex
-
Open URL Rewriter on Codeplex
-
DNN Rewrite Rule Generator
-
iFinity’s URL Master for DNN
-
IIS URL Rewrite Module Documentation
-
ASPnix Community: Web.Config Rewrite Rules
Steps and Code for DNN URL Rewriting
To manage and rewrite URLs effectively in DNN, follow these steps:
1. Installing URL Rewrite Modules
-
Install IIS URL Rewrite Module:
- Download and install the IIS URL Rewrite Module from the IIS.net website. This module allows you to create and manage URL rewrite rules directly in IIS.
-
Install iFinity URL Master (optional, for advanced URL management):
- This DNN extension helps with SEO-friendly URLs and provides additional tools to manage URLs in DNN. Visit iFinity’s URL Master product page to purchase and install.
2. Creating Rewrite Rules for SEO-Friendly URLs
- Basic IIS Rewrite Rule for DNN:
To enable cleaner and SEO-friendly URLs in DNN, you need to add rewrite rules to the
web.config
file of your DNN installation. Below is a sample rule:
<rewrite>
<rules>
<rule name="DNN SEO Friendly URLs" stopProcessing="true">
<match url="^([^/]+)/([^/]+)/([^/]+)$" />
<action type="Rewrite" url="/{R:1}/{R:2}/{R:3}" />
</rule>
</rules>
</rewrite>
This rule rewrites URLs to a cleaner structure, such as:
- 301 Redirect Rule:
If you’re implementing 301 redirects for old URLs to point to new ones, use the following rewrite rule in the web.config
:
<rewrite>
<rules>
<rule name="301 Redirect Old URL" stopProcessing="true">
<match url="^old-path$" />
<action type="Redirect" url="http://www.yoursite.com/new-path" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
This rule ensures that visitors and search engines are redirected to the correct page and helps preserve SEO rankings.
3. Testing URL Rewrite Rules
-
Use DNN’s URL Master Tool (iFinity): After installing URL Master, you can configure custom URL rules and manage them through the DNN admin panel. The tool allows you to rewrite and manage URLs without manually editing the web.config.
-
Testing via IIS: Once your rules are set up, use the IIS Rewrite Rule Testing feature to ensure that your rewrite rules are working as expected. Go to the IIS Manager, select the URL Rewrite section, and test individual rules.
4. Configuring DNN Settings for URL Management
DNN comes with built-in URL management settings to handle basic URL structures. You can adjust these settings by navigating to:
- Host Settings -> Advanced Settings -> URL Management
Make sure that the Friendly URLs option is enabled to allow DNN to process URLs in a more SEO-friendly way
5. Additional Configuration for SEO
-
301 Redirects for SEO: If you’re changing URLs or restructuring your site, it’s crucial to use 301 redirects to inform search engines about the change in URL structure. This ensures that your page ranking is preserved and that users are sent to the correct page.
-
Use Canonical Tags: If your site has duplicate content, implement canonical tags in your headers to indicate the preferred URL. This helps search engines avoid penalties for duplicate content.
Conclusion
By following these steps and using the resources provided, you can effectively manage URLs in DNN, improving both SEO and the user experience. Use IIS Rewrite Modules, the iFinity URL Master, and the built-in DNN URL management features to create clean, SEO-friendly URLs and redirect any outdated or duplicate URLs.