[Deprecated] Manually create automatic redirect to new document

Last modified by Irina Hrehorciuc on 2022/05/03 09:30

Home Nested Spaces Home Run Test

Steps to reproduce

  1. Create a document http://127.0.0.1:8080/xwiki/bin/view/1/
  2. Bookmark this document in your browser
  3. Create a second document http://127.0.0.1:8080/xwiki/bin/view/A/
  4. Create a separate page to run the following velocity script. The script will allow you to move document 1 to be a child document of A
    {{velocity}}
    #set ($source = $services.model.resolveSpace('1'))
    #set ($destination = $services.model.resolveSpace('A'))
    $services.refactoring.move($source, $destination).join()
    {{/velocity}}
  5. Go back to http://127.0.0.1:8080/xwiki/bin/view/1/ and recreate this page. In edit mode add the following redirect snippet and then save the page.
    {{velocity}}
    $response.sendRedirect($xwiki.getURL('A.1'))
    {{/velocity}}
  6. Click on the bookmark you made earlier.

Expected results

You have just manually created an automatic redirect link from http://127.0.0.1:8080/xwiki/bin/view/1/ to http://127.0.0.1:8080/xwiki/bin/view/A/1/ . The existing bookmark to the original document path continues to work, after manually creating a document with the old name and inserting the code snippet to perform the redirect. (MO5)

Results

per page of Page
Jira Issue
The environment prevents the table from loading data.
 
Page
Tags:
   

Get Connected