问题
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:
- Installed the urlrewrite extension on my IIS (http://www.iis.net/download/urlrewrite)
- 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