This project has moved and is read-only. For the latest updates, please go here.

Rewrite Query String URL

Oct 21, 2014 at 10:52 AM
I want To Rewrite This Url http://localhost/dotnetnuke_community/newsdetails?Id=134
into http://localhost/dotnetnuke_community/newsdetails/someNew

I did like this

public override List<UrlRule> GetRules(int PortalId)

        List<UrlRule> Rules = new List<UrlRule>();
ModuleController mc1 = new ModuleController();
        ArrayList modulesNewsDetails = mc1.GetModulesByDefinition(PortalId, "NewsDetails");
        ConfidentNews news = new ConfidentNews();
foreach (ModuleInfo module in modulesNewsDetails.OfType<ModuleInfo>())

            DataTable dtnews = news.GetIdAndHeadLineForUrlRewiter();

            foreach (DataRow dr in dtnews.Rows)
                var rule = new UrlRule
                    CultureCode = module.CultureCode,
                    TabId = module.TabID,
                    RuleType = UrlRuleType.Module,
                    //Parameters = "Id=" + dr["Id"].ToString(),
                    Parameters = "/newsdetails"+"?"+"Id=" + dr["Id"].ToString(),
                    Action = UrlRuleAction.Rewrite,
                    Url = "News/" + CleanupUrl(dr["Headline"].ToString()),
                    RemoveTab = true

return Rules;

but the url is not rewriting

please help

Oct 21, 2014 at 4:43 PM

Parameter must be something like :

Parameters = "Id=" + dr["Id"].ToString()

Tabid must be the tabid where the module generate the url.

Best is to check this in admin, open url rewrriter, view cache.

Oct 23, 2014 at 12:39 PM
Edited Oct 23, 2014 at 12:54 PM
Hi Sacha,
In admin-->open-url-rewriter
nothing is displaying if am clicking on view cache and view rule but all the rules are there in database.
Oct 23, 2014 at 1:19 PM

1) Do you use the standard skin on the page.
If not, can you try to use the standard gravity dnn skin on that page.
And see if you can view the cache.

2) can you find your module rules in the database ?

Oct 27, 2014 at 6:01 AM
Yes Rules are in the database.
Oct 28, 2014 at 11:35 AM