Friendly Urls in DotNetNuke - Troubleshooting

旧时模样 提交于 2019-12-08 04:00:07

问题


In DNN, I'm using Host Settings -> Friendly Url Settings to try and make a page url SEO-friendly. But I keep getting an error and I don't know why.

Current URL format:

http://localhost/dnn/Admin/MyPage.aspx?title=news-article-name-written-here

Desired URL format:

http://localhost/dnn/Admin/MyPage/news-article-name-written-here

"Friendly Url Settings" rule:

MATCH:  .*/MyPage/(.*) REPLACE WITH:  ~/Admin/MyPage.aspx?title=$1

Error:

Server Error in Application "DEFAULT WEB SITE/DNN"

Internet Information Services 7.5 Error Summary HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

As a side note, I'm not interested in buying any specialized DNN modules to do this (or using the free iFinity one). Any ideas at all what I might be doing wrong? Or, if this is impossible for some reason, could anybody please explain why?

Thanks very much in advance!


回答1:


Alright, solved it - as it turns out, you can't drop file extensions with the default DNN Url Rewriter. So here's what I did instead:

  1. Installed the urlrewrite extension on my IIS (http://www.iis.net/download/urlrewrite)
  2. Added the following code snippet to the <system.webServer> tag of the dnn site's web.config:

<rewrite><rules><rule name="UrlRewriteService" stopProcessing="true"><match url="^.*/MyPage/(.*)$"/><action type="Rewrite" url="Admin/MyPage.aspx?title={R:1}" /></rule></rules></rewrite>

Hope that helps somebody else!



来源:https://stackoverflow.com/questions/7083316/friendly-urls-in-dotnetnuke-troubleshooting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!