Space/page/blog with space characters in its name gives 404 Page Not Found
Asked by Matev? Grbec:

I successfully installed Confluence on my server. I already have IIS7 installed on this machine so I set that all requests for Confluence go through IIS web site.

The problem occurs when I create new space, blog post or page and its name includes space character (for example: "New page"). When I click on the title to see this page I get 404 Page Not Found IIS error. I found out that it is because of URL formatting. Confluence shows the URL as: [http://mysite.com/confluence/MYSPACE/New+Page. It](http://mysite.com/confluence/MYSPACE/New+Page.%C2%A0It) replaces space character with plus (+) character. If I manually replace it back with space character so the URL is like this: [http://mysite.com/confluence/MYSPACE/New page](http://mysite.com/confluence/MYSPACE/New%C2%A0page), then it works normally.

If I use names without space characters in them everything works as it should. If I access the web site directly through Tomcat (localhost with port number), everythings works (including the names with space characters). So I assume there is some URL rewrite rule or something similar that works on Tomcat but not when I access site through IIS and my domain name. Are there any guidelines which could help me identify it and fix it?


Answers:
author: Matev? Grbec
body: And finally I found the answer to my question. It is described here: <http://www.softweb.net.au/blogs/development/setting-up-a-friendly-url-for-confluence-using-iis7-url-rewriting>

The solution is:

"When you create a document in confluence that has spaces in the name, it will substitute +'s for the spaces in the URL. By default IIS won't process this properly as it is [viewed as a security risk](http://blogs.iis.net/thomad/archive/2007/12/17/iis7-rejecting-urls-containing.aspx). Instead you will see a 404 error if you view the site remotely, or a more informative 404.11 if you try locally. Nonetheless we need to disable this behaviour for our Confluence redirect to get it working properly. You can open up the Request Filtering section, click on the '*Edit Feature Settings* ' link, then tick 'Allow double escaping'.

It worked for me.

comments: author: Joe Clark
body: We have documentation on setting up IIS 7 with Confluence here: <http://confluence.atlassian.com/display/DOC/Connecting+Confluence+with+IIS+7#ConnectingConfluencewithIIS7-DoubleEscapedCharacter>

It mentions the need to allow double escaping on your IIS site. :-)


author: Thomas Wendel
body: The "double escaping"-solution handles the plus signs of URL to Confluence pages very well. However, I have a problem with attachments that have a plus sign in the **filename** . If I click on an attachment, I get 404. The URL is [http://somedomain.com/download/attachments/7078168/test%2Bpicture.png](http://somedomain.com/download/attachments/7078168/test%252Bpicture.png)

Do attachments with plus signs in the name work for you?


author: Lance Smith
body: Thanks for this. I was having this problem this morning after upgrading to the latest version. I knew I had run into it before but just couldn't remember how to get the URL's to properly resolve. Then I came across this post.


author: Nic Brough -Adaptavist-
body: Er, you shouldn't use spaces in urls (you should encode spaces with %20% instead), so there isn't really anything to fix.

comments: author: Matev? Grbec
body: Maybe I didn't describe the problem good enough. I don't use spaces in URL but for example in Page name as you can see here: <http://i40.tinypic.com/2w6t7hl.jpg> (the name is "My page name"). When I create such page, I can't see it, because Confluence replaces spaces with pluses: <http://i39.tinypic.com/23iz5md.jpg> . If I try to see it locally through Tomcat I can see the page normally: <http://i44.tinypic.com/2v9yh6s.jpg> . So I assume that IIS doesn't know how to handle such url properly.


author: Nic Brough -Adaptavist-
body: Ahh, I see, sorry, I thought you were trying to use them.

Yes, it looks like IIS is doing something bad with the + symbols in your URLs, so it's IIS breaking, not Confluence. I found an answer at <http://telligent.com/support/analytics/w/documentation/a-plus-sign-in-the-url-causes-a-404.aspx>