Bug #93287

Updated by Sybille Peters 8 months ago

If you create a new page, you can automatically add the page title in the pagetree. But often this does not work, so you end up having to change it again. Also, the URL created directly from the page title may not be the best choice, so you end up changing this again. 

 For every URL change, a redirect is now created (in sys_redirect). 

 *If the page is very new, I think a redirect is unnecessary. Also, if the page is hidden, a redirect is unnecessary.* 

 Many redirects degrades performance (see #90143). Also, many automatically created redirects make managing of manual redirects more difficult. 
 And, if you change it back and forth (which may happen over time), you get a redirect loop. Which results in an unusable page. 

 ... so I think it is a good strategy to create as little redirects as possible. 

 I think you could avoid this, by 

 - not creating redirects for redirects from or to _"default-title"_ (or whatever the default title is set to) 
 - not creating redirects for changed slugs if the page is hidden (or in another way not available) 
 - not creating redirects for very new pages 
 - and merging redirect chains (#93288) and avoid redirect loops (#89301) (but that is a separate issue) 

 h2. Reproduce (creating unnecessary redirects) 

 1. Create a new page using the default title (hidden) 
 2. change the slug (still hidden) 


 You will now have a redirect for the page. You can check in sys_redirect table. 

 Here an example, after changing /test-1/urls/default-title and doing this again for a hidden subpage. 

 select uid,FROM_UNIXTIME(createdon),source_path,target from sys_redirect where source_path like '/test-1/urls%' order by uid limit 5; 
 | uid | FROM_UNIXTIME(createdon) | source_path                          | target                            | 
 |    12 | 2021-01-14 08:28:31        | /test-1/urls/default-title           | /test-1/urls/subpage              | 
 |    13 | 2021-01-14 08:36:28        | /test-1/urls/subpage/default-title | /test-1/urls/subpage/subsubpage |