You can make use of the UrlRewriting module in Umbraco however getting extensionsless urls to work requires a change on your server. Are you on shared hosting? If you are it can sometimes be a problem as it is for one of my cleints hosts.
We host our own servers so I can make any changes on the server I want, I have added the following to the urlRewriting.config file, what else do I need to change on the server?
Excellent thank you all for the help, I am in fact using IIS6 so I made the change described by Tim in IIS and made the change to UrlRewriting.config as described by Simon. Works a treat. Shame I can't make two posts the solution!
Hmm, it appears this is not working completely as I would like, because as soon as it see's "/test" in the url it adds "/test-homepage.aspx" some other links I have do not work, for example if a user tries to access "/test-anotherpage.aspx" it tries to take them to /test-homepage.aspx-anotherpage.aspx"
Is there a way to resolve this? I literally only want to redirect to "/test-homepage.aspx" if someone types "/test"
could you also use umbracoUrlName as a docType property combined with the wildcard mapping to achieve the same on a content editor level.. .instead of the need to update the urlRewriting config all the time?
Thanks Morton, that seems to work but I have found that by adding the entry to IIS for aspnew_isapi.dll, it now means that I can no longer access the backend by going to www.mywebsite.com/umbraco. Why would this be? Does this mean I need to add an entry to UrlRewriting.config for /umbraco?
I know I can access it that way but it used to be accessible by just going to /umbraco. I don't want to have to tell users that they have to access it a different way
I was going to give that a try I just wondered why adding the aspnew_isapi.dll entry to IIS had stopped it working? Does adding that entry tell it to ignore any previous redirects or something along those lines?
Ok well when I add the entry to URLrewriting for the Umbraco backend, it seems to open the Umbraco login page (although instead of opening it as a pop-up window it opens it in the current window). The problem is when you login to Umbraco it doesn't really display much apart from some buttons that are missing their images. Is there a way to make it so that I get this to work for just one page without screwing up the Umbraco backend?
Did the backend work before you added the rewrite rule when you were using the umbrac/umbraco.aspx url? It may be my rewrite rule that is screwing up stuff like images, css, javascript and so on.
To answer your previous post, I think the issue is that when you add the wildcard rule to IIS, the then url /umbraco is not seen as a folder, and thus does not look for a page inside the folder (like default.aspx).
What happens if you try to go to the url of the image that looks broken directly in the browser?
Yes that is what the problem is, I would assume that it is starting to see anything with /umbraco and trying to redirect it, therefore anything in the /umbraco folder can no longer be seen.
I have got this working a different way now, I have added a new folder into the site and put a default.aspx page in with a redirect, I have then added that folder to web.config as an UmbracoReservedURL and UmbracoReservedPath, in the Reserved url I had to put it in single quotes to stop it acting as a wildcard.
Have URL without .aspx on the end
Hi,
I wondered how I could have a URL without .aspx on the end point to one of my pages. For example http://www.mywebsite.com/test would take someone to http://www.mywebsite.com/test-homepage.aspx?
You can make use of the UrlRewriting module in Umbraco however getting extensionsless urls to work requires a change on your server. Are you on shared hosting? If you are it can sometimes be a problem as it is for one of my cleints hosts.
Documentation for the UrlRewriting module can be found here:
http://www.urlrewriting.net/160/en/documentation.html
And you will find the config file in config/UrlRewriting.config in your site.
In your web.config set umbracoUseDirectoryUrls to true
And like Simon says, you need to add a wildcardmapping to IIS. For IIS7 check this link: http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/
We host our own servers so I can make any changes on the server I want, I have added the following to the urlRewriting.config file, what else do I need to change on the server?
You need to add a wildcard mapping to IIS, which tells it to use the aspnet_isapi.dll to serve all pages/folders.
To do this in II6:
Go to IIS
Right click on your website
Select Properties
Click the home directory tab
Click Configuration
On the mappings tab, click the Insert button, next to the wildcard mappings box
Click Browse and find the aspnew_isapi.dll, this can usually be found here: c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll
Untick verify that file exists and click OK
Click OK
Click OK
All done!
The IIS7 instructions can be found here http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/ as mentioned by Simon Dingley
T
Sorry Roel, my attribution for the IIS7 instructions should have been: Roel Snetselaar
I wish I could edit my posts!
There is also a good instruction of directory url in IIS7 here: http://umbraco.org/blog/2009/4/7/how-to-migrate-umbraco-40-to-iis-7-and-aspnet-35 (Section Directory urls and authentication)
Excellent thank you all for the help, I am in fact using IIS6 so I made the change described by Tim in IIS and made the change to UrlRewriting.config as described by Simon. Works a treat. Shame I can't make two posts the solution!
Hmm, it appears this is not working completely as I would like, because as soon as it see's "/test" in the url it adds "/test-homepage.aspx" some other links I have do not work, for example if a user tries to access "/test-anotherpage.aspx" it tries to take them to /test-homepage.aspx-anotherpage.aspx"
Is there a way to resolve this? I literally only want to redirect to "/test-homepage.aspx" if someone types "/test"
You probably need to change your rewrite a bit. It uses regular expressions to match the urls.
Try that. As far as I recall $ means "end of string" so it should not match /test-somethingelse type url's.
could you also use umbracoUrlName as a docType property combined with the wildcard mapping to achieve the same on a content editor level.. .instead of the need to update the urlRewriting config all the time?
Hi,
Thanks Morton, that seems to work but I have found that by adding the entry to IIS for aspnew_isapi.dll, it now means that I can no longer access the backend by going to www.mywebsite.com/umbraco. Why would this be? Does this mean I need to add an entry to UrlRewriting.config for /umbraco?
Hi,
To access the backend you will need to go to:
http://www.mywebsite.com/umbraco/umbraco.aspx
T
I know I can access it that way but it used to be accessible by just going to /umbraco. I don't want to have to tell users that they have to access it a different way
Hmm, I haven't actually tried doing a url rewrite for the admin area. But try it out and see if it works.
Something like this:
I was going to give that a try I just wondered why adding the aspnew_isapi.dll entry to IIS had stopped it working? Does adding that entry tell it to ignore any previous redirects or something along those lines?
Ok well when I add the entry to URLrewriting for the Umbraco backend, it seems to open the Umbraco login page (although instead of opening it as a pop-up window it opens it in the current window). The problem is when you login to Umbraco it doesn't really display much apart from some buttons that are missing their images. Is there a way to make it so that I get this to work for just one page without screwing up the Umbraco backend?
Did the backend work before you added the rewrite rule when you were using the umbrac/umbraco.aspx url? It may be my rewrite rule that is screwing up stuff like images, css, javascript and so on.
To answer your previous post, I think the issue is that when you add the wildcard rule to IIS, the then url /umbraco is not seen as a folder, and thus does not look for a page inside the folder (like default.aspx).
What happens if you try to go to the url of the image that looks broken directly in the browser?
Yes that is what the problem is, I would assume that it is starting to see anything with /umbraco and trying to redirect it, therefore anything in the /umbraco folder can no longer be seen.
I have got this working a different way now, I have added a new folder into the site and put a default.aspx page in with a redirect, I have then added that folder to web.config as an UmbracoReservedURL and UmbracoReservedPath, in the Reserved url I had to put it in single quotes to stop it acting as a wildcard.
In the web.config you can set the umbracoUseDirectoryUrls on True
You also have to change the settings in IIS
-Go to the root of your website and click properties
-Select tab: Home directory
-Click configuration
-Then click insert a new wildcard application in the bottom of that screen
-A input box pops up, select the .net Handdler: c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll (maybe change file location)
-Uncheck the verify file exists checkbox
Grrr did not see this was already the third page.
Yeah, you may want to check the previous pages, the method you described caused some additional problems but thanks anyway.
When I add the wildcard in IIS my homepage breaks - I get a 500 error unless I add /home to the URL. ANy ideas why this would happen?
is working on a reply...