Unable to delete a page that is not accessible (URL)


I’ve been having issues removing some pages on one of our sub wikis that someone on my team created. At the time when those pages were created our Tomcat 8 had not been setup to support \ & / symbols in URLs, which I think is at the root cause of the issue(s).

Here’s what I’ve done up to now and the progress I’ve made:

  1. Page were create using “/” in the name. A page was also create with “/” in the name (probably figured it would do some escape character magic?". Both cause pages that cannot be deleted.

  2. I’ve since then change out Tomcat 8’s catalina.properties file to add support for both \ and /.

  3. I tried accessing the pages but was still unable to do so. I made a quick velocity script to show all the pages:

#set($spaceList = $xwiki.getSpaces())
#set($num = 0)
#foreach($space in $spaceList)
  #set($num = $num + 1)
  #set($docuSpace = "${space}.WebHome")
  #set($docu = $xwiki.getDocument($docuSpace))
  * $num) isHidden = $docu.isHidden() || [[$space>>$docuSpace]]

The pages that are not accessible show up.

  1. I then use some code I found a link for on this forum to delete the pages programatically since the URLs were not helpful (cannot use /delete/ method). The snippet was from @vmassol if I am not mistaken.
    I was able to remove some of the pages but not all of them.

  2. I check again with the snippet from #3 to see the pages that remain. 3 of them show up in that list and 1 does not.
    When all 4 of these are tried in the snippet mentioned in #4, they return the following The document that you’re trying to delete does not exist, nothing will be done.
    The three pages that show up using my #3 snippet do not seem to show up in breadcrumbs/navigation (showhidden=true). The one that does not show up in my snippet shows up in the breadcrumbs/navigation though! :expressionless:
    I’ve tried recreating that last one and here is what I got (already exists error message):

I’m somewhat out of ideas on what else to try for these last 4 pages. Any ideas anyone? :slight_smile:


When I have this issue (could not find a page with special character), I use this way:

  • I’m check on my profile if I can see hidden page
  • I use Ctrl + G to open the popup “Go to” and typing “V2 - Hardware” and select the page I want to delete.
  • I click on “Edit” (to avoid some page with redirection in it)
  • and I change the url by replacing “edit” by “delete”
    ** or I copy/paste the full name (from “Go to” popup) of the page to use it in velocity script

Anyways from your screenshot you can click on “Edit” and change URL like I said previously)

Pascal B

Note: the menu with delete action is accessible in edit mode too.


Hi Pascal,
Thanks for the reply.

Concerning this, I mention this in my post:

The URL does not work and cannot be accessed, whether it is by “view”, “delete”, etc. Also, the screenshot is of me trying to create a page (not edit) in the space of that “not existing page” to confirm that my sub wiki does seem to think it exists even though it is thoroughly not accessible by any ways I can think of.
I was thinking maybe if I can create a page there to replace the non existing one I can then delete it proper but I cannot even do that… :frowning:
Any other ideas?

With velocity script (Ctrl+G to copy/paste doc fullname) ?

 #set($document = $xwiki.getDocument('Sandbox.test2.WebHome'))
 ## Get the internal document
 #set($xwikidocument = $document.getDocument())
 ## Remove it
 #set($discard = $xwiki.getXWiki().deleteDocument($xwikidocument, false, $xcontext.context))

from: http://lists.xwiki.org/pipermail/users/2013-March/025049.html

1 Like

Thanks for this piece of code.

I tried the velocity script but the pages still show up in bread crumbs/navigation but not in my list from my snippet above. I think that might be an important distinction since otherwise that code seems to list every other page and their children properly that are on that sub-wiki.

I’ve tested the script on other test pages I created for this purpose in the same space as the problematic one and I seem to have no issues having the velocity script delete those.

I added one line to see if the doc exists (calling $xwiki.exists() ). It seems my (newly created for deletion purposes) do exist before deletion and after a refresh do not (as expected).
Unfortunately, the pages I am trying to delete while they do show up in bread crumbs/navigation, they do not show up in my listing of all pages/their children and also do not seem to exist according to that call. But they do on that path when I try to create one there (as seen in the screenshot of my first post).

Kinda at a loss now. This seems to point that the expected path is not the one stored inside the database/XWiki.


P.-S.: For reference/completeness, here is the modified snippet:

 #set($document = $xwiki.getDocument('Servo Erector Set (SES) Building System.SES V1 \/ V2 - Hardware.WebHome'))
 ## Get the internal document
 #set($xwikidocument = $document.getDocument())
 #set($docExists = $xwiki.exists($xwikidocument))
 ## Display details on doc
 * $document || [[$document>>$xwikidocument]]
 * Exists? $docExists
 ## Remove it
 ##set($discard = $xwiki.getXWiki().deleteDocument($xwikidocument, false, $xcontext.context))

I guess you need to escape the backslash ‘\’ (i.e. double it) like:

 #set($document = $xwiki.getDocument('Servo Erector Set (SES) Building System.SES V1 \\/ V2 - Hardware.WebHome'))

It works for me in that case.

BTW: you need to set the variables in the tomcat setenv.sh or the like, not in catalina.properties, as far as I know. You should be able to access these pages in tomcat without need to delete them.

1 Like


Will try now! :slight_smile:

Oh, interesting. I found the info while searching for how to enable it on tomcat8. I’ll look into this more closely!

Thanks for the help (and extra hope :stuck_out_tongue:)


Yes, that worked out fine! :smiley:
Thank you very much to @Pbas, @tmortagne, @ClemensRobbenhaar

I’ll be trying this out and so I can finally access those pages in case someone else in my team creates those. I am quite certain the issue was with Tomcat’s handling of / & .


It would be really useful if you provide the actual solution in setenv.sh