Changing a URL (directory) doesn't redirect to the new URL nor does it cease to exist.
For example,
If I change the video's directory from abc to xyz, both pages are still available on the website:
site.com/videos/abc
site.com/videos/xyz
Furthermore, the old URL displays the following error:
Fatal error: Uncaught TypeError: array_slice(): Argument #1 ($array) must be of type array, null given in /www/wwwroot/site/admin/smarty/template-c-site/%%10^109^109F0088%%include_content_comments.tpl.php:13 Stack trace: #0 /www/wwwroot/site/admin/smarty/template-c-site/%%10^109^109F0088%%include_content_comments.tpl.php(13): array_slice() #1 /www/wwwroot/site/admin/smarty/Smarty.class.php(1877): include('...') #2 /www/wwwroot/site/admin/smarty/template-c-site/%%59^590^59079386%%video_comments_video_comments.tpl.php(94): Smarty->_smarty_include() #3 /www/wwwroot/site/admin/smarty/Smarty.class.php(1271): include('...') #4 /www/wwwroot/site/admin/include/process_page.php(2058): Smarty->fetch() #5 /www/wwwroot/site/admin/smarty/internals/core.run_insert_handler.php(51): insert_getBlock() #6 /www/wwwroot/site/admin/smarty/template-c-site/%%6D^6D1^6D168B67%%view_video.tpl.php(6): smarty_core_run_insert_handler() #7 /www/wwwroot/site/admin/smarty/Smarty.class.php(1271): include('...') #8 /www/wwwroot/site/admin/include/process_page.php(1534): Smarty->fetch() #9 /www/wwwroot/site/view_video.php(1): require_once('...') #10 {main} thrown in /www/wwwroot/site/admin/smarty/template-c-site/%%10^109^109F0088%%include_content_comments.tpl.php on line 13
However, there are generally no issues with this file, as it's working correctly on other video pages, both those with and without comments.
How can I have the old URL redirect to the new one after changing the directory? Alternatively, if that's not possible, how can I have the old URL removed from the site? Please note that manual solutions, such as creating the redirect manually in .htaccess, isn't ideal as that there will be more (potentially hundreds of) videos with changed directories.