Rewrite Query String URL

Oct 21, 2014 at 9: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
                };
                Rules.Add(rule);
            }


        }
return Rules;
}

but the url is not rewriting

please help

Regards,
satyampriya
Coordinator
Oct 21, 2014 at 3:43 PM
Hi

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.

Regards,
Sacha
Oct 23, 2014 at 11:39 AM
Edited Oct 23, 2014 at 11:54 AM
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.
Coordinator
Oct 23, 2014 at 12:19 PM
Hi,

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 ?

Regards,
Sacha
Oct 27, 2014 at 5:01 AM
Hi,
Yes Rules are in the database.
Oct 28, 2014 at 10:35 AM