we want to remove the .aspx extensions from our webpage, how can we achive the url-rewrite, I tried to do this IIS7 but its not working any other way will be helpful.
I changed this setting to true <add key="umbracoUseDirectoryUrls" value="true" /> and I know get the following error, however if I remove / at the end of the URL ( http://fgmtest.gorillahq.com/resources ) manually it works,
No umbraco document matches the url 'http://fgmtest.gorillahq.com/resources/'
umbraco tried this to match it using this xpath query'/root/*/* [@urlName = "resources"] | /root/* [@urlName = ""]')
This page can be replaced with a custom 404 page by adding the id of the umbraco document to show as 404 page in the /config/umbracoSettings.config file. Just add the id to the '/settings/content/errors/error404' element.
Edit: Didn't actually read your post well, so we'll move on. Maybe it has to do with some of your IIS settings as the slash is intepretated as a folder.
The <add key="umbracoUseDirectoryUrls" value="true" /> only rewrites URL from the top menu only. and ignores the Left Hand Menu (LHM)http://fgmtest.gorillahq.com/what-is-fgm.aspx how can we rewrite the LHM as well.
I have added a rule to remove the trailing / and it works now:
what does your code for lefthand menu look like? maybe the extension is being added manually or something?
maybe take a look at your top menu macro's code and your left menu macro's code and see what the difference is. they should be using <a href="{umbraco.library:NiceUrl(@id)}"> (if you're using xslt)
perhaps post the code from your leftmenu here and we can see whats going on? another problem maybe that you've got macro caching enabled on that particular macro and its still rendering the old code?
Follwing is the code for Left hand menu, I put this in the Master Template (Hard Coded):
<ul> <li><strong><a href="/what-is-fgm.aspx" class="light_blue" title="What is FGM?">What is FGM?</a></strong></li> <li><strong><a href="/where-is-fgm-practiced.aspx" class="light_pink" title="Where is FGM practiced?">Where is FGM practiced?</a></strong></li> <li><strong><a href="/background-to-fgm.aspx" class="light_green" title="Background to FGM">Background to FGM</a></strong></li> <li><strong><a href="/beliefs-and-issues.aspx" class="light_beige" title="Beliefs and Issues">Beliefs and Issues</a></strong></li> <li><strong><a href="/complications-of-fgm.aspx" class="dark_blue" title="Complications of FGM">Complications of FGM</a></strong></li> <li><strong><a href="/fgm-in-nz.aspx" class="grey_green" title="FGM in New Zealand">FGM in New Zealand</a></strong></li> <li><strong><a href="/faq.aspx" class="dark_pink" title="FAQ">FAQ</a></li> </ul>
I have set the <add key="umbracoUseDirectoryUrls" value="true" /> as soon as I set this key property to true this was appending / at the end of the URL, for example:http://fgmtest.gorillahq.com/resources/to remove the trailing slash / I had to a IIS7 URL Rewrite:
OK, so.. if you're hardcoding your menu directly in your template there's not much Umbraco is going to do to it. at best you should write a macro (using either xslt or Razor) to loop through the pages you want in that menu, that way of someone adds or unpublishes a page your menu will be updated accordingly. no work required, that's the whole point of using a CMS right?
maybe tell me a little bit more about how you've structured your content and I can help you with the macro writing part.
at worst you could either just remove the .aspx from those urls manually or change them to <a href="{umbraco.library:NiceUrl(1012)}">your link here</a> <-- where 1012 is the id of the page that you want to link to
URL Rewrite in umbraco
Hi
we are using 4.0 and 4.7 on IIS7
we want to remove the .aspx extensions from our webpage, how can we achive the url-rewrite, I tried to do this IIS7 but its not working any other way will be helpful.
Many thanks for your help in advance.
Kind Regards
Hi Praveen
In order to use extensionless urls all you should do is modify this line in the web.config file
<add key="umbracoUseDirectoryUrls" value="true" /> and it should be set to true.
hope this helps.
/Jan
Hi Jan
Thanks for the quick reply
I changed this setting to true <add key="umbracoUseDirectoryUrls" value="true" /> and I know get the following error, however if I remove / at the end of the URL ( http://fgmtest.gorillahq.com/resources ) manually it works,
Changing the umbracoUseDirectoryUrls to True has no impact of the left hand menu http://fgmtest.gorillahq.com/what-is-fgm.aspx
Page not found
No umbraco document matches the url 'http://fgmtest.gorillahq.com/resources/'
umbraco tried this to match it using this xpath query'/root/*/* [@urlName = "resources"] | /root/* [@urlName = ""]')
This page can be replaced with a custom 404 page by adding the id of the umbraco document to show as 404 page in the /config/umbracoSettings.config file. Just add the id to the '/settings/content/errors/error404' element.
For more information, visit information about custom 404 on the umbraco website.
This page is intentionally left ugly ;-)
Remove trailing slash :-)
Edit: Didn't actually read your post well, so we'll move on. Maybe it has to do with some of your IIS settings as the slash is intepretated as a folder.
ha ha.....from where bro....all I did was set the <add key="umbracoUseDirectoryUrls" value="true" /> to TRUE
Hi there
The <add key="umbracoUseDirectoryUrls" value="true" /> only rewrites URL from the top menu only. and ignores the Left Hand Menu (LHM)http://fgmtest.gorillahq.com/what-is-fgm.aspx how can we rewrite the LHM as well.
I have added a rule to remove the trailing / and it works now:
However I am still unable to remove the .aspx for the "Left Hand Menu" http://fgmtest.gorillahq.com/what-is-fgm.aspx
any help will be greatly appreciated
what does your code for lefthand menu look like?
maybe the extension is being added manually or something?
maybe take a look at your top menu macro's code and your left menu macro's code and see what the difference is.
they should be using <a href="{umbraco.library:NiceUrl(@id)}"> (if you're using xslt)
perhaps post the code from your leftmenu here and we can see whats going on?
another problem maybe that you've got macro caching enabled on that particular macro and its still rendering the old code?
- Tim
Hi Tim
Follwing is the code for Left hand menu, I put this in the Master Template (Hard Coded):
<ul>
<li><strong><a href="/what-is-fgm.aspx" class="light_blue" title="What is FGM?">What is FGM?</a></strong></li>
<li><strong><a href="/where-is-fgm-practiced.aspx" class="light_pink" title="Where is FGM practiced?">Where is FGM practiced?</a></strong></li>
<li><strong><a href="/background-to-fgm.aspx" class="light_green" title="Background to FGM">Background to FGM</a></strong></li>
<li><strong><a href="/beliefs-and-issues.aspx" class="light_beige" title="Beliefs and Issues">Beliefs and Issues</a></strong></li>
<li><strong><a href="/complications-of-fgm.aspx" class="dark_blue" title="Complications of FGM">Complications of FGM</a></strong></li>
<li><strong><a href="/fgm-in-nz.aspx" class="grey_green" title="FGM in New Zealand">FGM in New Zealand</a></strong></li>
<li><strong><a href="/faq.aspx" class="dark_pink" title="FAQ">FAQ</a></li>
</ul>
I have set the <add key="umbracoUseDirectoryUrls" value="true" /> as soon as I set this key property to true this was appending / at the end of the URL, for example: http://fgmtest.gorillahq.com/resources/ to remove the trailing slash / I had to a IIS7 URL Rewrite:
Code for IIS7 URL Rewrite is as follows:
<rewrite>
<rewriteMaps>
<rewriteMap name="/home">
<add key="/home/" value="/" />
</rewriteMap>
</rewriteMaps>
<outboundRules>
<preConditions>
<preCondition name="ResponseIsHtml1">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
<rules>
<rule name="Remove trailing slash" enabled="true" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
</rule>
</rules>
</rewrite>
Many thanks for your help and lok forward for your reply.
Best Regards
OK, so..
if you're hardcoding your menu directly in your template there's not much Umbraco is going to do to it.
at best you should write a macro (using either xslt or Razor) to loop through the pages you want in that menu, that way of someone adds or unpublishes a page your menu will be updated accordingly. no work required, that's the whole point of using a CMS right?
maybe tell me a little bit more about how you've structured your content and I can help you with the macro writing part.
at worst you could either just remove the .aspx from those urls manually or change them to
<a href="{umbraco.library:NiceUrl(1012)}">your link here</a> <-- where 1012 is the id of the page that you want to link to
if you want to remove the trailing slash, check out this post
you dont need to add a IIS7 rewrite, its a config setting that you just need to change.
http://our.umbraco.org/forum/core/general/21597-Trailing-Slash-Breaking-DirectoryUrls
good luck
- Tim
Hi Tim
That was very helpful, many many thanks.
yes if you can help me to do the macro that will be very helpful. all the yellow folders are the top menu and below that are the LHM.
is working on a reply...