Two things to check:1. Delete the jcrPauseInstallation folder if you see under /system/sling/installer/jcr2. Check for error in error.log when deploying your code.
Did you followed these two documentations for package inclusion:-https://adobe-consulting-services.github.io/acs-aem-commons/pages/maven.html https://github.com/Adobe-Marketing-Cloud/aem-core-wcm-components#include-core-components-as-subpackage-into-your-own-project-maven-build
Your first URL goes towards selector implementation in AEM, Look at the complete guide here https://helpx.adobe.com/experience-manager/6-2/managing/using/seo-and-url-management.html
You properly would have to overlay this file /libs/foundation/components/page/redirect.jsp or /libs/wcm/foundation/components/page/redirect.html and correct logic for your use case. Doesn't seems to be much of work.