seo friendly url

Jun 18, 2013 at 9:04 PM
Can anyone give the idea of url rewriting in nb-store with Open Url Rewriter. i have a module i just want to use laptop.aspx instead of product.aspx?id=4 in dotnetnuke..... Any help will be appreciated.....
Coordinator
Jun 19, 2013 at 7:17 AM
Hi,

Witch module are you using ?

Is it a self made module ?

Regards,
Sacha
Coordinator
Jun 19, 2013 at 7:22 AM
Is it nb stotre witch generate product.aspx?id=4 ?

If yes, how is the configuration of nb store to obtain this ?

Is your website accessible ?
Jun 19, 2013 at 8:28 AM
module is for just showing casestudies....module is creared by myself. i just want to show each casestudy with specific url.... not with product.aspx?id=4.. i just want to know how it possible...
Coordinator
Jun 19, 2013 at 10:55 AM
You have to create your OpenUrlRewriter Provider and add them to web.config.

Here a simple exemple :
namespace Satrabel.OpenUrlRewriter.DNNSimpleArticle
{
    public class DNNSimpleArticleUrlRuleProvider : UrlRuleProvider
    {

        public override List<UrlRule> GetRules(int PortalId)
        {
            List<UrlRule> Rules = new List<UrlRule>();

            ModuleController mc = new ModuleController();
            ArrayList modules = mc.GetModulesByDefinition(PortalId, "dnnsimplearticle");

            foreach (ModuleInfo module in modules.OfType<ModuleInfo>())
            {
                var articles = ArticleController.GetArticles(module.ModuleID);
                
                
                foreach (var article in articles)
                {
                    var rule = new UrlRule
                    {
                        CultureCode = module.CultureCode,
                        TabId = module.TabID,
                        RuleType = UrlRuleType.Module,
                        Parameters = "aid="+article.ArticleId.ToString(),
                        Action = UrlRuleAction.Rewrite,
                        Url = CleanupUrl(article.Title),
                        RemoveTab = false
                    };                    
                    Rules.Add(rule);                    
                }
            }             
            return Rules;
        }

    }
}
A little more info here
Jun 19, 2013 at 11:05 AM
Hi Sancha,

i was waiting for your replay... Thanks a lot..... I am not aware of these things... So if you can would please explain step by step?

Create OpenUrlRewriter Provider means adding new provider like NbStoreUrlRuleProvider inside OpenUrlRewriter_00.03.00?
Coordinator
Jun 19, 2013 at 12:52 PM
Edited Jun 19, 2013 at 12:53 PM
Hi,

You have 2 options : 1) create a new dll (like nbstore_openurlprovider) or 2) create a source file in your app_code directory.

For the dll option, you can have a look at the DNNSimpleArticle provider source zip file
https://openurlrewriter.codeplex.com/releases/view/108176

I explain you the simple way (app_code) :

1) Create a directory mymodule in app_code

2) define this directory in your web.config
<compilation>
   <codeSubDirectories>
     <add directoryName="mymodule"/>
   </codeSubDirectories>
</compilation>
3) create your provider class in the new directory

Exemple :
https://openurlrewriter.codeplex.com/SourceControl/latest#DNNSimpleArticle_OpenUrlRewriter/DNNSimpleArticleUrlRuleProvider.cs

modify the namespace and class name and modify the logic to generate 1 urlRule for each url to rewrite.

4) add the provider to web.config
<urlRule defaultProvider="tabUrlRuleProvider">
  <providers>
    <clear/>
    <add name="myModuleUrlRuleProvider" type="MyNameSpace.MyModuleUrlRuleProvider"/>
  </providers>
</urlRule>
Jun 19, 2013 at 1:28 PM
Hi Sancha....

Thanks a lot for your replay.....i will have a look and let you know the result....

Thanks a million.....
Jun 27, 2013 at 12:15 PM
Hi Sancha,

Its worked for me... Thanks a lot... One more question it shows pagename/seourl.aspx Is there any way remove pagename?

Regards,
Geo
Coordinator
Jun 27, 2013 at 12:50 PM
Hi,

In your provider, you have to put

RemoveTab = true

on each urlrule

Be sure to have no conflicts with other urls from other pages.

Regards,
Sacha
Jun 27, 2013 at 2:01 PM
Hi Sancha,

i just tried with RemoveTab = true. but it doesnt work.. if you look at cre8.cre8demo.com/portfolio.aspx i just want to called each one with different pagename.aspx...

it was working some while cre8.cre8demo.com/pagename/client.aspx but now it works as pagename/cid/1.aspx

do you know why is it?
Coordinator
Jun 27, 2013 at 3:25 PM
Hi,

It's like portfolio is renamed in portfolio-about-best-cre8-web-design-projects ?

You can first try a clear cache.

If its not ok after that.

You have to look in the cache (in the Open Url Rewiter module on the admin menu), if you can find the urlrule with Parameters : cid=1 and tabid=90

The url you have, is the default url, when the rule can't be find.

Regards,
Sacha
Jun 27, 2013 at 4:06 PM
Hi Sancha,

i checked the url rules cache but there is no list with CID (CID=1, CID=2....).
If you check stored url rules list , we can see the list CID.

Is there any setting missing?

It's like portfolio is renamed in portfolio-about-best-cre8-web-design-projects ?
it is because <add name="tabUrlRuleProvider" type="Satrabel.HttpModules.Provider.TabUrlRuleProvider, Satrabel.OpenUrlRewriter" useKeyWords="true" /> i guess?

Can we use different urlruleprovider in a single dnn instance?

Regards,
Geo
Coordinator
Jun 27, 2013 at 4:17 PM
Hi,
i checked the url rules cache but there is no list with CID (CID=1, CID=2....).
If you check stored url rules list , we can see the list CID.
This is because in the past your provider have generate the rules and now not anymore.
(Maybe a exception happens, or something like that that stop the generation of the url rules)
It's like portfolio is renamed in portfolio-about-best-cre8-web-design-projects ?
it is because <add name="tabUrlRuleProvider" type="Satrabel.HttpModules.Provider.TabUrlRuleProvider, Satrabel.OpenUrlRewriter" useKeyWords="true" /> i guess?
That's right.
Normally keywords are separated by commas ",".
If you do that, it pickup only the first keyword as url.
Can we use different urlruleprovider in a single dnn instance?
At the moment no.

In next version you can enable/disable the providers by portal and also have provider settings by portal.

Regards,
Sacha
Jun 27, 2013 at 4:22 PM
i checked the url rules cache but there is no list with CID (CID=1, CID=2....).
If you check stored url rules list , we can see the list CID.

This is because in the past your provider have generate the rules and now not anymore.
(Maybe a exception happens, or something like that that stop the generation of the url rules)

Is there any solution for that? (reinstall or something)
Coordinator
Jun 27, 2013 at 4:31 PM
Try to clear the stored url rules.
A know in the next version i have correct a little thing, about conflict with stored url rules.

Do you have a button for that on your version ?

Can you post the or send private the source code of your provider ?

Regards
Jun 28, 2013 at 8:47 AM

<codeSubDirectories>
   <add directoryName="Cre8.UrlProvider"/>

</codeSubDirectories>

<urlRule defaultProvider="PortfolioUrlProvider">
  <providers>
    <clear />
    <add name="tabUrlRuleProvider" type="Satrabel.HttpModules.Provider.TabUrlRuleProvider, Satrabel.OpenUrlRewriter" useKeyWords="true" />
    <add name="userUrlRuleProvider" type="Satrabel.HttpModules.Provider.UserUrlRuleProvider, Satrabel.OpenUrlRewriter" />
    <add name="languageUrlRuleProvider" type="Satrabel.HttpModules.Provider.LanguageUrlRuleProvider, Satrabel.OpenUrlRewriter" />
    <add name="ctlUrlRuleProvider" type="Satrabel.HttpModules.Provider.CtlUrlRuleProvider, Satrabel.OpenUrlRewriter" />
    <add name="PortfolioUrlProvider" type="Cre8.UrlProvider" />
  </providers>
</urlRule>

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections;
using System.Collections.Generic;
using DotNetNuke.Common.Utilities;

using DotNetNuke.Entities.Modules;
using DotNetNuke.Framework.Providers;
using Satrabel.HttpModules.Provider;
using Cre8.Modules.wh_casestudy;
//using DotNetNuke.Modules.dnnsimplearticle.Components;
//using DotNetNuke.Modules.dnnsimplearticle.services;



namespace Cre8.UrlProvider
{
public class PortfolioUrlProvider : UrlRuleProvider
{

    private const string ProviderType = "urlRule";
    private const string ProviderName = "PortfolioUrlProvider";

    private readonly ProviderConfiguration _providerConfiguration = ProviderConfiguration.GetProviderConfiguration(ProviderType);
    private readonly bool includePageName = true;

    public PortfolioUrlProvider()
    {
        var objProvider = (DotNetNuke.Framework.Providers.Provider)_providerConfiguration.Providers[ProviderName];
        if (!string.IsNullOrEmpty(objProvider.Attributes["includePageName"]))
        {
            includePageName = bool.Parse(objProvider.Attributes["includePageName"]);
        }
        //CacheKeys = new string[] { "DNNSimpleArticle-ProperyValues-All" };
    }

    public override List<UrlRule> GetRules(int PortalId)
    {
        List<UrlRule> Rules = new List<UrlRule>();
        wh_casestudyController  objCtrl = new wh_casestudyController();
        ModuleController mc = new ModuleController();
        ArrayList modules = mc.GetModulesByDefinition(PortalId, "wh_casestudy");

        //foreach (ModuleInfo module in modules.OfType<ModuleInfo>().GroupBy(m => m.ModuleID).Select(g => g.First())){                
        foreach (ModuleInfo module in modules)
        {
            var Portfolios = objCtrl.Getwh_casestudy_list(module.ModuleID);

            foreach (var portfolio in Portfolios)
            {
                var rule = new UrlRule
                {
                    CultureCode = module.CultureCode,
                    TabId = module.TabID,
                    RuleType = UrlRuleType.Module,
                    Parameters = "CID=" + portfolio.CaseStudy_ID.ToString(),
                    Action = UrlRuleAction.Rewrite,
                    Url = CleanupUrl(portfolio.Title),
                    RemoveTab = !includePageName
                };
                Rules.Add(rule);
            }
        }

        return Rules;
    }

}
}
Coordinator
Jun 28, 2013 at 9:09 AM
Hi,

There is a error in web.config.

you have to replace

<add name="PortfolioUrlProvider" type="Cre8.UrlProvider" />

by

<add name="PortfolioUrlProvider" type="Cre8.UrlProvider.PortfolioUrlProvider " />

(with namespace + class name)

and if you replace it by

<add name="PortfolioUrlProvider" type="Cre8.UrlProvider.PortfolioUrlProvider " includePageName="false" />

the rewriter removes the pagename in the url

Regards,
Sacha
Jun 28, 2013 at 9:31 AM
Hi Sancha,

Thanks a lot..... Its working now......

can i ask one more things?

I didnt write anything for taburl provider? how the main pages changes with keyword?

you told me one urlprovider will work at a time...

Regards,
Geo
Coordinator
Jun 28, 2013 at 11:11 AM
Edited Jun 28, 2013 at 11:11 AM
Hi,

To explain a little more :

There are 3 types of providers (url rules types in reality) : Language, Tab, Module

Each type manage a specific part of the url.
http://www.mysitealias.com/[language part]/[tab part]/[module part]?querrystring
The included default TabProvider have a setting useKeywords .
<add name="tabUrlRuleProvider" type="Satrabel.HttpModules.Provider.TabUrlRuleProvider, Satrabel.OpenUrlRewriter" useKeyWords="true" />
If this setting is set to true in the web.config (or in the new version 0.4 also per portal).

The url generated for each tab (page) use the first keyword of the keywords field of the page setting.
(keywords are separeted by commas ",")
Otherwise it use the page name.

Regards,
Sacha
Jun 28, 2013 at 1:49 PM
Hi Sancha,

Thanks a lot for your help....... I have to say nobody else has helped this much.....

Thanks a lot.....

Regards,
Geo
Aug 5, 2013 at 11:24 PM
Hi,

I am trying to install "DNNSimpleArticle_OpenUrlRewriter_01.00.00_Install" on my DNN 7.1 environment. When installing i get an failure error - "Failure A dependent component is not installed - "

Can any one please help me out in this. Please....
Aug 6, 2013 at 10:28 AM
Hi Rajesh,

Plese try OpenUrlRewriter71_00.04.03_Install.zip for dnn 7

Regards,
Geo
Aug 6, 2013 at 10:50 PM
Hi Geo,

Thanks for your reply. But unfortunately I have tried installing the OpenUrlRewriter71_00.04.03_Install.zip for dnn 7 and after that I tried installing "DNNSimpleArticle_OpenUrlRewriter_01.00.00_Install". Still it gives me an error "Failure A dependent component is not installed - ".
Coordinator
Aug 9, 2013 at 2:54 PM
Hi,

Do you read the release notes ?

This provider work only with DNNSimpleArticle V00.01.00

I have made this choice because V00.02.00 don't really add new features and remove dnn 6 compatibility.

Regards,
Sacha